← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/indicator-me/trunk] Rev 109: reference file for i18n; fix hint style

 

Merge authors:
  David Barth (dbarth)
Related merge proposals:
  https://code.launchpad.net/~dbarth/indicator-me/hint-fixes/+merge/36170
  proposed by: David Barth (dbarth)
  review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 109 [merge]
committer: David Barth <david.barth@xxxxxxxxxxxxx>
branch nick: indicator-me
timestamp: Wed 2010-09-22 11:09:08 +0200
message:
  reference file for i18n; fix hint style
modified:
  po/POTFILES.in
  src/indicator-me.c


--
lp:indicator-me
https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk

Your team ayatana-commits is subscribed to branch lp:indicator-me.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk/+edit-subscription
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in	2010-01-06 05:30:46 +0000
+++ po/POTFILES.in	2010-09-21 16:54:53 +0000
@@ -5,3 +5,4 @@
 src/status-provider-telepathy.c
 src/me-service.c
 src/me-service-dbus.c
+src/me-service-gwibber.c

=== modified file 'src/indicator-me.c'
--- src/indicator-me.c	2010-09-22 04:27:15 +0000
+++ src/indicator-me.c	2010-09-22 09:09:08 +0000
@@ -92,6 +92,7 @@
                                 DbusmenuClient   * client);
 static void     entry_activate_cb (GtkEntry *entry, DbusmenuMenuitem *mi);
 static void     entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GValue *value, GtkEntry *entry);
+static gboolean entry_hint_is_shown (GtkWidget *widget);
 
 G_DEFINE_TYPE (IndicatorMe, indicator_me, INDICATOR_OBJECT_TYPE);
 
@@ -303,9 +304,9 @@
 
   const gchar *hint = g_object_get_data (G_OBJECT (entry),
                                          DBUSMENU_ENTRY_MENUITEM_PROP_HINT);
-  if (gtk_entry_get_text_length (entry) > 0 ||
-      GTK_WIDGET_HAS_FOCUS (entry)) {
-    g_debug ("%s, the hint shouldn't be shown atm", __func__);
+  if ((gtk_entry_get_text_length (entry) > 0 &&
+       ! entry_hint_is_shown (GTK_WIDGET (entry)))
+      || GTK_WIDGET_HAS_FOCUS (entry)) {
 
     entry_set_style (entry, GTK_STATE_NORMAL);
     entry_hint_set_shown (GTK_WIDGET (entry), FALSE);
@@ -320,10 +321,11 @@
   }
 }
 
-
 static void
 entry_set_hint (GtkEntry *entry, const char *hint)
 {
+    g_return_if_fail (GTK_IS_ENTRY (entry));
+
     g_debug ("entry hint: %s", hint);
 		g_object_set_data_full (G_OBJECT (entry), DBUSMENU_ENTRY_MENUITEM_PROP_HINT,
                             g_strdup (hint), (GDestroyNotify) g_free);
@@ -403,6 +405,57 @@
 	dbusmenu_menuitem_handle_event (mi, "send", &value, gtk_get_current_event_time());
 }
 
+static void
+finalized_dbusmenuitem_cb (gpointer udata, GObject * dbusmenuitem)
+{
+  /* disconnect signals we previously installed to avoid
+     crashing on outdated data structures */
+
+	g_debug("DbusmenuMenuitem was destroyed");
+
+  int i = 0;
+
+  g_return_if_fail (IDO_IS_ENTRY_MENU_ITEM (udata));
+
+  g_debug ("1");
+
+  IdoEntryMenuItem *ido = IDO_ENTRY_MENU_ITEM (udata);
+
+  g_debug ("2");
+
+	GtkEntry *entry = GTK_ENTRY(ido_entry_menu_item_get_entry (ido));
+
+  g_debug ("3");
+
+	i += 
+    g_signal_handlers_disconnect_by_func (DBUSMENU_MENUITEM (dbusmenuitem),
+                                          G_CALLBACK (entry_prop_change_cb),
+                                          entry);
+
+  g_return_if_fail (GTK_IS_ENTRY (entry));
+
+  g_debug ("%s", __func__);
+
+  i += 
+  g_signal_handlers_disconnect_by_func (entry,
+                                        G_CALLBACK (entry_activate_cb),
+                                        dbusmenuitem);
+  i += 
+  g_signal_handlers_disconnect_by_func (entry,
+                                        G_CALLBACK (entry_focus_grab_cb),
+                                        entry);
+  i += 
+  g_signal_handlers_disconnect_by_func (entry,
+                                        G_CALLBACK (entry_focus_ungrab_cb),
+                                        entry);
+
+  g_debug ("%s: %d signals disconnected", __func__, i);
+
+  return;
+}
+
+
+
 static gboolean
 new_entry_item (DbusmenuMenuitem * newitem,
                 DbusmenuMenuitem * parent,
@@ -443,6 +496,8 @@
 #endif
 
 	dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent);
+	g_object_weak_ref(G_OBJECT(newitem), finalized_dbusmenuitem_cb, ido);
+
 	/* disconnect the activate signal that newitem_base connected with the wrong
 	   widget, ie menuitem, and re-connect it with the /entry/ instead */
 	gulong signal_id = g_signal_handler_find (GTK_MENU_ITEM (ido), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, parent);
@@ -450,6 +505,7 @@
     g_signal_handler_disconnect(GTK_MENU_ITEM (ido), signal_id);
 
 	g_signal_connect (DBUSMENU_MENUITEM (newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK (entry_prop_change_cb), entry);
+
 	g_signal_connect (GTK_ENTRY (entry), "activate", G_CALLBACK (entry_activate_cb), newitem);
 
   g_signal_connect (entry,