emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/gtkutil.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/gtkutil.c
Date: Mon, 27 Jan 2003 14:36:11 -0500

Index: emacs/src/gtkutil.c
diff -c emacs/src/gtkutil.c:1.6 emacs/src/gtkutil.c:1.7
*** emacs/src/gtkutil.c:1.6     Sun Jan 26 13:23:54 2003
--- emacs/src/gtkutil.c Mon Jan 27 14:36:10 2003
***************
*** 759,765 ****
        GtkWidget *w;
        GtkRequisition req;
  
!       if (strcmp (item->name, "message") == 0)
          {
            /* This is the text part of the dialog.  */
            w = gtk_label_new (utf8_label);
--- 759,765 ----
        GtkWidget *w;
        GtkRequisition req;
  
!       if (item->name && strcmp (item->name, "message") == 0)
          {
            /* This is the text part of the dialog.  */
            w = gtk_label_new (utf8_label);
***************
*** 776,782 ****
            gtk_widget_size_request (w, &req);
            gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (wdialog)->vbox),
                                 req.height);
!         if (strlen (item->value) > 0)
              button_spacing = 2*req.width/strlen (item->value);
          }
        else
--- 776,782 ----
            gtk_widget_size_request (w, &req);
            gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (wdialog)->vbox),
                                 req.height);
!         if (item->value && strlen (item->value) > 0)
              button_spacing = 2*req.width/strlen (item->value);
          }
        else
***************
*** 1201,1208 ****
  static int
  xg_separator_p (char *name)
  {
    return strcmp (name, "--") == 0
!     || strcmp (name, "--:") == 0
      || strcmp (name, "---") == 0;
  }
  
--- 1201,1210 ----
  static int
  xg_separator_p (char *name)
  {
+   if (! name) return 0;
+ 
    return strcmp (name, "--") == 0
!     || strncmp (name, "--:", 3) == 0
      || strcmp (name, "---") == 0;
  }
  
***************
*** 1539,1544 ****
--- 1541,1547 ----
    return w;
  }
  
+ /* Return the label for menu item WITEM.  */
  static const char *
  xg_get_menu_item_label (witem)
       GtkMenuItem *witem;
***************
*** 1547,1562 ****
    return gtk_label_get_label (wlabel);
  }
  
  static int
  xg_item_label_same_p (witem, label)
       GtkMenuItem *witem;
       char *label;
  {
!   int is_same;
    char *utf8_label = get_utf8_string (label);
!   
!   is_same = strcmp (utf8_label, xg_get_menu_item_label (witem)) == 0;
!   if (utf8_label != label) g_free (utf8_label);
  
    return is_same;
  }
--- 1550,1571 ----
    return gtk_label_get_label (wlabel);
  }
  
+ /* Return non-zero if the menu item WITEM has the text LABEL.  */
  static int
  xg_item_label_same_p (witem, label)
       GtkMenuItem *witem;
       char *label;
  {
!   int is_same = 0;
    char *utf8_label = get_utf8_string (label);
!   const char *old_label = witem ? xg_get_menu_item_label (witem) : 0;
! 
!   if (! old_label && ! utf8_label)
!     is_same = 1;
!   else if (old_label && utf8_label)
!     is_same = strcmp (utf8_label, old_label) == 0;
! 
!   if (utf8_label && utf8_label != label) g_free (utf8_label);
  
    return is_same;
  }
***************
*** 1773,1778 ****
--- 1782,1789 ----
    GtkLabel *wkey = 0;
    char *utf8_label;
    char *utf8_key;
+   const char *old_label = 0;
+   const char *old_key = 0;
    xg_menu_item_cb_data *cb_data;
    
    wchild = gtk_bin_get_child (GTK_BIN (w));  
***************
*** 1812,1825 ****
          }
      }
  
!   if (utf8_key && strcmp (utf8_key, gtk_label_get_label (wkey)) != 0)
      gtk_label_set_text (wkey, utf8_key);
  
!   if (strcmp (utf8_label, gtk_label_get_label (wlbl)) != 0)
      gtk_label_set_text_with_mnemonic (wlbl, utf8_label);
  
!   if (utf8_key != val->key) g_free (utf8_key);
!   if (utf8_label != val->name) g_free (utf8_label);
    
    if (! val->enabled && GTK_WIDGET_SENSITIVE (w))
      gtk_widget_set_sensitive (w, FALSE);
--- 1823,1840 ----
          }
      }
  
!   
!   if (wkey) old_key = gtk_label_get_label (wkey);
!   if (wlbl) old_label = gtk_label_get_label (wlbl);
!   
!   if (wkey && utf8_key && (! old_key || strcmp (utf8_key, old_key) != 0))
      gtk_label_set_text (wkey, utf8_key);
  
!   if (! old_label || strcmp (utf8_label, old_label) != 0)
      gtk_label_set_text_with_mnemonic (wlbl, utf8_label);
  
!   if (utf8_key && utf8_key != val->key) g_free (utf8_key);
!   if (utf8_label && utf8_label != val->name) g_free (utf8_label);
    
    if (! val->enabled && GTK_WIDGET_SENSITIVE (w))
      gtk_widget_set_sensitive (w, FALSE);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]