Diff of /trunk/src/relation_edit.c

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

revision 239 by harbaum, Thu Jul 23 13:15:53 2009 UTC revision 240 by harbaum, Thu Jul 23 18:50:17 2009 UTC
# Line 83  static gboolean relation_add_item(GtkWid Line 83  static gboolean relation_add_item(GtkWid
83    
84    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
85    
86    char *type = osm_tag_get_by_key(relation->tag, "type");    char *type = osm_tag_get_by_key(OSM_TAG(relation), "type");
87    
88    char *info_str = NULL;    char *info_str = NULL;
89    if(type) info_str = g_strdup_printf(_("In relation of type: %s"), type);    if(type) info_str = g_strdup_printf(_("In relation of type: %s"), type);
# Line 93  static gboolean relation_add_item(GtkWid Line 93  static gboolean relation_add_item(GtkWid
93                                gtk_label_new(info_str));                                gtk_label_new(info_str));
94    g_free(info_str);    g_free(info_str);
95    
96    char *name = osm_tag_get_by_key(relation->tag, "name");    char *name = osm_tag_get_by_key(OSM_TAG(relation), "name");
97    if(name)    if(name)
98      gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox),      gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox),
99                                  gtk_label_new(name));                                  gtk_label_new(name));
# Line 152  static gboolean relation_add_item(GtkWid Line 152  static gboolean relation_add_item(GtkWid
152    (*memberP)->object = *object;    (*memberP)->object = *object;
153    (*memberP)->role = role;    (*memberP)->role = role;
154    
155    relation->flags |= OSM_FLAG_DIRTY;    OSM_FLAGS(relation) |= OSM_FLAG_DIRTY;
156    return TRUE;    return TRUE;
157  }  }
158    
# Line 175  static void relation_remove_item(relatio Line 175  static void relation_remove_item(relatio
175        osm_member_free(*member);        osm_member_free(*member);
176        *member = next;        *member = next;
177    
178        relation->flags |= OSM_FLAG_DIRTY;        OSM_FLAGS(relation) |= OSM_FLAG_DIRTY;
179    
180        return;        return;
181      } else      } else
# Line 193  static void relation_item_list_selected( Line 193  static void relation_item_list_selected(
193    
194  /* try to find something descriptive */  /* try to find something descriptive */
195  static char *relation_get_descriptive_name(relation_t *relation) {  static char *relation_get_descriptive_name(relation_t *relation) {
196    char *name = osm_tag_get_by_key(relation->tag, "ref");    char *name = osm_tag_get_by_key(OSM_TAG(relation), "ref");
197    if (!name)    if (!name)
198      name = osm_tag_get_by_key(relation->tag, "name");      name = osm_tag_get_by_key(OSM_TAG(relation), "name");
199    if (!name)    if (!name)
200      name = osm_tag_get_by_key(relation->tag, "note");      name = osm_tag_get_by_key(OSM_TAG(relation), "note");
201    if (!name)    if (!name)
202      name = osm_tag_get_by_key(relation->tag, "fix" "me");      name = osm_tag_get_by_key(OSM_TAG(relation), "fix" "me");
203    return name;    return name;
204  }  }
205    
# Line 231  static void on_relation_item_add(GtkWidg Line 231  static void on_relation_item_add(GtkWidg
231      gtk_list_store_set(context->store, &iter,      gtk_list_store_set(context->store, &iter,
232                         RELITEM_COL_SELECTED, FALSE,                         RELITEM_COL_SELECTED, FALSE,
233                         RELITEM_COL_TYPE,                         RELITEM_COL_TYPE,
234                         osm_tag_get_by_key(relation->tag, "type"),                         osm_tag_get_by_key(OSM_TAG(relation), "type"),
235                         RELITEM_COL_NAME, name,                         RELITEM_COL_NAME, name,
236                         RELITEM_COL_DATA, relation,                         RELITEM_COL_DATA, relation,
237                         -1);                         -1);
# Line 281  static void on_relation_item_edit(GtkWid Line 281  static void on_relation_item_edit(GtkWid
281    
282    // Found it. Update all visible fields that belong to the relation iself.    // Found it. Update all visible fields that belong to the relation iself.
283    gtk_list_store_set(context->store, &iter,    gtk_list_store_set(context->store, &iter,
284      RELITEM_COL_TYPE,    osm_tag_get_by_key(sel->tag, "type"),       RELITEM_COL_TYPE,    osm_tag_get_by_key(OSM_TAG(sel), "type"),
285      RELITEM_COL_NAME,    relation_get_descriptive_name(sel),       RELITEM_COL_NAME,    relation_get_descriptive_name(sel),
286      -1);      -1);
287    
288    // Order will probably have changed, so refocus    // Order will probably have changed, so refocus
# Line 435  static GtkWidget *relation_item_list_wid Line 435  static GtkWidget *relation_item_list_wid
435      gtk_list_store_append(context->store, &iter);      gtk_list_store_append(context->store, &iter);
436      gtk_list_store_set(context->store, &iter,      gtk_list_store_set(context->store, &iter,
437         RELITEM_COL_SELECTED, relitem_is_in_relation(context->item, relation),         RELITEM_COL_SELECTED, relitem_is_in_relation(context->item, relation),
438         RELITEM_COL_TYPE, osm_tag_get_by_key(relation->tag, "type"),         RELITEM_COL_TYPE, osm_tag_get_by_key(OSM_TAG(relation), "type"),
439         RELITEM_COL_ROLE, relitem_get_role_in_relation(context->item, relation),         RELITEM_COL_ROLE, relitem_get_role_in_relation(context->item, relation),
440         RELITEM_COL_NAME, name,         RELITEM_COL_NAME, name,
441         RELITEM_COL_DATA, relation,         RELITEM_COL_DATA, relation,
# Line 702  void relation_show_members(GtkWidget *pa Line 702  void relation_show_members(GtkWidget *pa
702    member_context_t *mcontext = g_new0(member_context_t, 1);    member_context_t *mcontext = g_new0(member_context_t, 1);
703    mcontext->relation = relation;    mcontext->relation = relation;
704    
705    char *str = osm_tag_get_by_key(mcontext->relation->tag, "name");    char *str = osm_tag_get_by_key(OSM_TAG(mcontext->relation), "name");
706    if(!str) str = osm_tag_get_by_key(mcontext->relation->tag, "ref");    if(!str) str = osm_tag_get_by_key(OSM_TAG(mcontext->relation), "ref");
707    if(!str)    if(!str)
708      str = g_strdup_printf(_("Members of relation #" ITEM_ID_FORMAT),      str = g_strdup_printf(_("Members of relation #" ITEM_ID_FORMAT),
709                            OSM_ID(mcontext->relation));                            OSM_ID(mcontext->relation));
# Line 763  static void on_relation_add(GtkWidget *b Line 763  static void on_relation_add(GtkWidget *b
763      gtk_list_store_set(context->store, &iter,      gtk_list_store_set(context->store, &iter,
764                         RELATION_COL_ID, OSM_ID(relation),                         RELATION_COL_ID, OSM_ID(relation),
765                         RELATION_COL_TYPE,                         RELATION_COL_TYPE,
766                         osm_tag_get_by_key(relation->tag, "type"),                         osm_tag_get_by_key(OSM_TAG(relation), "type"),
767                         RELATION_COL_NAME, name,                         RELATION_COL_NAME, name,
768                         RELATION_COL_MEMBERS, num,                         RELATION_COL_MEMBERS, num,
769                         RELATION_COL_DATA, relation,                         RELATION_COL_DATA, relation,
# Line 806  static void on_relation_edit(GtkWidget * Line 806  static void on_relation_edit(GtkWidget *
806    // Found it. Update all visible fields.    // Found it. Update all visible fields.
807    gtk_list_store_set(context->store, &iter,    gtk_list_store_set(context->store, &iter,
808      RELATION_COL_ID,      OSM_ID(sel),      RELATION_COL_ID,      OSM_ID(sel),
809      RELATION_COL_TYPE,    osm_tag_get_by_key(sel->tag, "type"),      RELATION_COL_TYPE,    osm_tag_get_by_key(OSM_TAG(sel), "type"),
810      RELATION_COL_NAME,    relation_get_descriptive_name(sel),      RELATION_COL_NAME,    relation_get_descriptive_name(sel),
811      RELATION_COL_MEMBERS, osm_relation_members_num(sel),      RELATION_COL_MEMBERS, osm_relation_members_num(sel),
812      -1);      -1);
# Line 889  static GtkWidget *relation_list_widget(r Line 889  static GtkWidget *relation_list_widget(r
889      gtk_list_store_set(context->store, &iter,      gtk_list_store_set(context->store, &iter,
890                         RELATION_COL_ID, OSM_ID(rel),                         RELATION_COL_ID, OSM_ID(rel),
891                         RELATION_COL_TYPE,                         RELATION_COL_TYPE,
892                         osm_tag_get_by_key(rel->tag, "type"),                         osm_tag_get_by_key(OSM_TAG(rel), "type"),
893                         RELATION_COL_NAME, name,                         RELATION_COL_NAME, name,
894                         RELATION_COL_MEMBERS, num,                         RELATION_COL_MEMBERS, num,
895                         RELATION_COL_DATA, rel,                         RELATION_COL_DATA, rel,

Legend:
Removed from v.239  
changed lines
  Added in v.240