patch for encoded tool bar button tips



The encoding change from a couple of days ago missed one case: tool tips for
tool bar buttons are still showing up as encoded ASCII. Here's a simple
patch for this. It also fixes a pair of storage leaks in another place in
the same file that was using this same technique. Should I go ahead and
check this in?

John

Index: bonobo/bonobo-win.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-win.c,v
retrieving revision 1.59
diff -u -p -u -r1.59 bonobo-win.c
--- bonobo/bonobo-win.c    2000/10/12 15:01:11    1.59
+++ bonobo/bonobo-win.c    2000/10/12 18:04:12
@@ -1301,15 +1301,14 @@ put_hint_in_statusbar (GtkWidget *menuit
                "encoding this node's tip",
                bonobo_ui_xml_make_path (node));
-        return;
-    }
-
-    if (priv->main_status) {
+    } else if (priv->main_status) {
         guint id;
 
         id = gtk_statusbar_get_context_id (priv->main_status,
                           "BonoboWin:menu-hint");
         gtk_statusbar_push (priv->main_status, id, txt);
     }
+
     g_free (txt);
     bonobo_ui_node_free_string (hint);
 }
@@ -2051,12 +2050,22 @@ toolbar_sync_state (BonoboWinPrivate *pr
     }
     
     if ((txt = cmd_get_attr (node, cmd_node, "tip"))) {
+        gboolean err;
+        char *decoded_txt;
 
-        bonobo_ui_toolbar_item_set_tooltip (
-            BONOBO_UI_TOOLBAR_ITEM (widget),
-            bonobo_ui_toolbar_get_tooltips (
-                BONOBO_UI_TOOLBAR (parent)), txt);
+        decoded_txt = bonobo_ui_util_decode_str (txt, &err);
+        if (err) {
+            g_warning ("Encoding error in tip on '%s', ensure you are "
+                   "encoding this node's tip",
+                   bonobo_ui_xml_make_path (node));
+        } else {
+            bonobo_ui_toolbar_item_set_tooltip (
+                BONOBO_UI_TOOLBAR_ITEM (widget),
+                bonobo_ui_toolbar_get_tooltips (
+                    BONOBO_UI_TOOLBAR (parent)), decoded_txt);
+        }
 
+        g_free (decoded_txt);
         bonobo_ui_node_free_string (txt);
     }
 }





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