Diff of /trunk/src/info.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 154 by harbaum, Tue Mar 31 06:31:53 2009 UTC revision 163 by harbaum, Tue Apr 14 19:26:18 2009 UTC
# Line 335  static GtkWidget *tag_widget(tag_context Line 335  static GtkWidget *tag_widget(tag_context
335    return context->list;    return context->list;
336  }  }
337    
338    static void on_relation_members(GtkWidget *but, tag_context_t *context) {
339      g_assert(context->object.type == RELATION);
340      relation_show_members(context->dialog, context->object.relation);
341    }
342    
343  /* edit tags of currently selected node or way or of the relation */  /* edit tags of currently selected node or way or of the relation */
344  /* given */  /* given */
345  gboolean info_dialog(GtkWidget *parent, appdata_t *appdata, object_t *object) {  gboolean info_dialog(GtkWidget *parent, appdata_t *appdata, object_t *object) {
# Line 360  gboolean info_dialog(GtkWidget *parent, Line 365  gboolean info_dialog(GtkWidget *parent,
365    
366    switch(context->object.type) {    switch(context->object.type) {
367    case NODE:    case NODE:
368      str = g_strdup_printf(_("Node #%ld"), context->object.node->id);      str = g_strdup_printf(_("Node #" ITEM_ID_FORMAT), context->object.node->id);
369      user = context->object.node->user;      user = context->object.node->user;
370      work_copy = osm_tags_copy(context->object.node->tag, FALSE);      work_copy = osm_tags_copy(context->object.node->tag, FALSE);
371      stime = context->object.node->time;      stime = context->object.node->time;
# Line 368  gboolean info_dialog(GtkWidget *parent, Line 373  gboolean info_dialog(GtkWidget *parent,
373      break;      break;
374    
375    case WAY:    case WAY:
376      str = g_strdup_printf(_("Way #%ld"), context->object.way->id);      str = g_strdup_printf(_("Way #" ITEM_ID_FORMAT), context->object.way->id);
377      user = context->object.way->user;      user = context->object.way->user;
378      work_copy = osm_tags_copy(context->object.way->tag, FALSE);      work_copy = osm_tags_copy(context->object.way->tag, FALSE);
379      stime = context->object.way->time;      stime = context->object.way->time;
# Line 381  gboolean info_dialog(GtkWidget *parent, Line 386  gboolean info_dialog(GtkWidget *parent,
386      break;      break;
387    
388    case RELATION:    case RELATION:
389      str = g_strdup_printf(_("Relation #%ld"), context->object.relation->id);      str = g_strdup_printf(_("Relation #" ITEM_ID_FORMAT),
390                              context->object.relation->id);
391      user = context->object.relation->user;      user = context->object.relation->user;
392      work_copy = osm_tags_copy(context->object.relation->tag, FALSE);      work_copy = osm_tags_copy(context->object.relation->tag, FALSE);
393      stime = context->object.relation->time;      stime = context->object.relation->time;
# Line 407  gboolean info_dialog(GtkWidget *parent, Line 413  gboolean info_dialog(GtkWidget *parent,
413    
414    /* making the dialog a little wider makes it less "crowded" */    /* making the dialog a little wider makes it less "crowded" */
415  #ifdef USE_HILDON  #ifdef USE_HILDON
416    gtk_window_set_default_size(GTK_WINDOW(context->dialog), 500, 400);    gtk_window_set_default_size(GTK_WINDOW(context->dialog), 440, 400);
417  #else  #else
418    // Conversely, desktop builds should display a little narrower    // Conversely, desktop builds should display a little narrower
419    gtk_window_set_default_size(GTK_WINDOW(context->dialog), 400, 300);    gtk_window_set_default_size(GTK_WINDOW(context->dialog), 400, 300);
# Line 417  gboolean info_dialog(GtkWidget *parent, Line 423  gboolean info_dialog(GtkWidget *parent,
423    GtkWidget *table = gtk_table_new(2, 2, FALSE);  // x, y    GtkWidget *table = gtk_table_new(2, 2, FALSE);  // x, y
424    
425    /* ------------ user ----------------- */    /* ------------ user ----------------- */
426    char *u_str = NULL;    if(user) {
427    if(user) u_str = g_strdup_printf(_("User: %s"), user->name);      label = gtk_label_new(user->name);
428    else     u_str = g_strdup_printf(_("User: ---"));      gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
429    label = gtk_label_new(u_str);      gtk_table_attach_defaults(GTK_TABLE(table),  label, 0, 1, 0, 1);
430    gtk_table_attach_defaults(GTK_TABLE(table),  label, 0, 1, 0, 1);    }
   g_free(u_str);  
431    
432    /* ------------ time ----------------- */    /* ------------ time ----------------- */
433    
434    struct tm *loctime = localtime(&stime);    struct tm *loctime = localtime(&stime);
435    char time_str[32];    char time_str[32];
436    strftime(time_str, sizeof(time_str), "%x %X", loctime);    strftime(time_str, sizeof(time_str), "%x %X", loctime);
437    char *t_str = g_strdup_printf(_("Time: %s"), time_str);    label = gtk_label_new(time_str);
   label = gtk_label_new(t_str);  
   g_free(t_str);  
438    gtk_table_attach_defaults(GTK_TABLE(table),  label, 1, 2, 0, 1);    gtk_table_attach_defaults(GTK_TABLE(table),  label, 1, 2, 0, 1);
439    
440    /* ------------ coordinate (only for nodes) ----------------- */    /* ------------ coordinate (only for nodes) ----------------- */
# Line 470  gboolean info_dialog(GtkWidget *parent, Line 473  gboolean info_dialog(GtkWidget *parent,
473      gint nodes = 0, ways = 0, relations = 0;      gint nodes = 0, ways = 0, relations = 0;
474      member_t *member = context->object.relation->member;      member_t *member = context->object.relation->member;
475      while(member) {      while(member) {
476        switch(member->type) {        switch(member->object.type) {
477        case NODE:        case NODE:
478        case NODE_ID:        case NODE_ID:
479          nodes++;          nodes++;
# Line 491  gboolean info_dialog(GtkWidget *parent, Line 494  gboolean info_dialog(GtkWidget *parent,
494        member = member->next;        member = member->next;
495      }      }
496    
497      char *str = g_strdup_printf(_("Members: %d nodes, %d ways, %d relations"),      char *str =
498                                  nodes, ways, relations);        g_strdup_printf(_("Members: %d nodes, %d ways, %d relations"),
499                          nodes, ways, relations);
500    
501        GtkWidget *member_btn = gtk_button_new_with_label(str);
502        gtk_signal_connect(GTK_OBJECT(member_btn), "clicked",
503                           GTK_SIGNAL_FUNC(on_relation_members), context);
504        gtk_table_attach_defaults(GTK_TABLE(table), member_btn, 0, 2, 1, 2);
505    
     gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new(str), 0, 2, 1, 2);  
506      g_free(str);      g_free(str);
507      break;      break;
508    

Legend:
Removed from v.154  
changed lines
  Added in v.163