/[emacs]/emacs/src/gtkutil.c
ViewVC logotype

Diff of /emacs/src/gtkutil.c

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

revision 1.6 by jhd, Sun Jan 26 18:23:54 2003 UTC revision 1.7 by jhd, Mon Jan 27 19:36:10 2003 UTC
# Line 759  create_dialog (wv, select_cb, deactivate Line 759  create_dialog (wv, select_cb, deactivate
759        GtkWidget *w;        GtkWidget *w;
760        GtkRequisition req;        GtkRequisition req;
761    
762        if (strcmp (item->name, "message") == 0)        if (item->name && strcmp (item->name, "message") == 0)
763          {          {
764            /* This is the text part of the dialog.  */            /* This is the text part of the dialog.  */
765            w = gtk_label_new (utf8_label);            w = gtk_label_new (utf8_label);
# Line 776  create_dialog (wv, select_cb, deactivate Line 776  create_dialog (wv, select_cb, deactivate
776            gtk_widget_size_request (w, &req);            gtk_widget_size_request (w, &req);
777            gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (wdialog)->vbox),            gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (wdialog)->vbox),
778                                 req.height);                                 req.height);
779            if (strlen (item->value) > 0)            if (item->value && strlen (item->value) > 0)
780              button_spacing = 2*req.width/strlen (item->value);              button_spacing = 2*req.width/strlen (item->value);
781          }          }
782        else        else
# Line 1201  make_menu_item (utf8_label, utf8_key, it Line 1201  make_menu_item (utf8_label, utf8_key, it
1201  static int  static int
1202  xg_separator_p (char *name)  xg_separator_p (char *name)
1203  {  {
1204      if (! name) return 0;
1205    
1206    return strcmp (name, "--") == 0    return strcmp (name, "--") == 0
1207      || strcmp (name, "--:") == 0      || strncmp (name, "--:", 3) == 0
1208      || strcmp (name, "---") == 0;      || strcmp (name, "---") == 0;
1209  }  }
1210    
# Line 1539  xg_create_widget (type, name, f, val, Line 1541  xg_create_widget (type, name, f, val,
1541    return w;    return w;
1542  }  }
1543    
1544    /* Return the label for menu item WITEM.  */
1545  static const char *  static const char *
1546  xg_get_menu_item_label (witem)  xg_get_menu_item_label (witem)
1547       GtkMenuItem *witem;       GtkMenuItem *witem;
# Line 1547  xg_get_menu_item_label (witem) Line 1550  xg_get_menu_item_label (witem)
1550    return gtk_label_get_label (wlabel);    return gtk_label_get_label (wlabel);
1551  }  }
1552    
1553    /* Return non-zero if the menu item WITEM has the text LABEL.  */
1554  static int  static int
1555  xg_item_label_same_p (witem, label)  xg_item_label_same_p (witem, label)
1556       GtkMenuItem *witem;       GtkMenuItem *witem;
1557       char *label;       char *label;
1558  {  {
1559    int is_same;    int is_same = 0;
1560    char *utf8_label = get_utf8_string (label);    char *utf8_label = get_utf8_string (label);
1561        const char *old_label = witem ? xg_get_menu_item_label (witem) : 0;
1562    is_same = strcmp (utf8_label, xg_get_menu_item_label (witem)) == 0;  
1563    if (utf8_label != label) g_free (utf8_label);    if (! old_label && ! utf8_label)
1564        is_same = 1;
1565      else if (old_label && utf8_label)
1566        is_same = strcmp (utf8_label, old_label) == 0;
1567    
1568      if (utf8_label && utf8_label != label) g_free (utf8_label);
1569    
1570    return is_same;    return is_same;
1571  }  }
# Line 1773  xg_update_menu_item (val, w, select_cb, Line 1782  xg_update_menu_item (val, w, select_cb,
1782    GtkLabel *wkey = 0;    GtkLabel *wkey = 0;
1783    char *utf8_label;    char *utf8_label;
1784    char *utf8_key;    char *utf8_key;
1785      const char *old_label = 0;
1786      const char *old_key = 0;
1787    xg_menu_item_cb_data *cb_data;    xg_menu_item_cb_data *cb_data;
1788        
1789    wchild = gtk_bin_get_child (GTK_BIN (w));      wchild = gtk_bin_get_child (GTK_BIN (w));  
# Line 1812  xg_update_menu_item (val, w, select_cb, Line 1823  xg_update_menu_item (val, w, select_cb,
1823          }          }
1824      }      }
1825    
1826    if (utf8_key && strcmp (utf8_key, gtk_label_get_label (wkey)) != 0)    
1827      if (wkey) old_key = gtk_label_get_label (wkey);
1828      if (wlbl) old_label = gtk_label_get_label (wlbl);
1829      
1830      if (wkey && utf8_key && (! old_key || strcmp (utf8_key, old_key) != 0))
1831      gtk_label_set_text (wkey, utf8_key);      gtk_label_set_text (wkey, utf8_key);
1832    
1833    if (strcmp (utf8_label, gtk_label_get_label (wlbl)) != 0)    if (! old_label || strcmp (utf8_label, old_label) != 0)
1834      gtk_label_set_text_with_mnemonic (wlbl, utf8_label);      gtk_label_set_text_with_mnemonic (wlbl, utf8_label);
1835    
1836    if (utf8_key != val->key) g_free (utf8_key);    if (utf8_key && utf8_key != val->key) g_free (utf8_key);
1837    if (utf8_label != val->name) g_free (utf8_label);    if (utf8_label && utf8_label != val->name) g_free (utf8_label);
1838        
1839    if (! val->enabled && GTK_WIDGET_SENSITIVE (w))    if (! val->enabled && GTK_WIDGET_SENSITIVE (w))
1840      gtk_widget_set_sensitive (w, FALSE);      gtk_widget_set_sensitive (w, FALSE);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26