diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2012-09-19 15:21:55 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2012-09-19 15:21:55 -0400 |
commit | 96f010d993f596b0799a673cd19a4decdf08d8d4 (patch) | |
tree | 0231ec2c995cef6918d354336a7c5a5b0ef4d484 | |
parent | edcdb07267e0c6724469f87475063f97e00a2123 (diff) | |
download | libayatana-indicator-96f010d993f596b0799a673cd19a4decdf08d8d4.tar.gz libayatana-indicator-96f010d993f596b0799a673cd19a4decdf08d8d4.tar.bz2 libayatana-indicator-96f010d993f596b0799a673cd19a4decdf08d8d4.zip |
Import upstream version 12.10.1
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libindicator/indicator-object.c | 64 | ||||
-rw-r--r-- | tests/dummy-indicator-visible.c | 12 | ||||
-rw-r--r-- | tests/test-loader.c | 24 | ||||
-rw-r--r-- | tools/indicator-loader.c | 59 |
9 files changed, 103 insertions, 109 deletions
@@ -22,4 +22,5 @@ Robert Ancell Robert Carr Sebastien Bacher + Tarmac Ted Gould @@ -1,5 +1,29 @@ # Generated by Makefile. Do not edit. +2012-09-19 Charles Kerr <charles.kerr@canonical.com> + + 12.10.1 + +2012-09-12 Charles Kerr <charles.kerr@canonical.com> + + In libindicator, remove the cloak/decloak code in IndicatorObject to address Bug #1045372. + + In indicator-loader, support hiding & re-showing IndicatorObjectEntries by caching their menuitems and using gtk_widget_hide / gtk_widget_show. + + In tests/test-loader and tests/dummy-indicator-visible.c, support hiding & re-showing IndicatorObjectEntries by caching their parent widgetry instead of using gtk_widget_destroy().. Fixes: https://bugs.launchpad.net/bugs/1045372. Approved by Lars Uebernickel, jenkins. + +2012-09-11 Charles Kerr <charles.kerr@canonical.com> + + In tests/test-loader and tests/dummy-indicator-visible.c, support hiding & re-showing IndicatorObjectEntries by caching their parent widgetry instead of using gtk_widget_destroy() + +2012-09-11 Charles Kerr <charles.kerr@canonical.com> + + No newline at end of file + +2012-09-11 Charles Kerr <charles.kerr@canonical.com> + + remove the cloak/decloak widget logic + 2012-07-11 Charles Kerr <charles.kerr@canonical.com> bump version to 12.10.0 @@ -1,3 +1,9 @@ +12.10.1 + + - merge lp:~charlesk/libindicator/lp-1045372 to remove the 'cloak' + code that caused libreoffice's menubars in unity to be greyed + out after opening any dialog or switching windows (lp: 1045372) + 12.10.0 - merge lp:~evgeni/libindicator/multiarch-same-devheaders so that we @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libindicator 12.10.0. +# Generated by GNU Autoconf 2.69 for libindicator 12.10.1. # # Report bugs to <http://bugs.launchpad.net/libindicator>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libindicator' PACKAGE_TARNAME='libindicator' -PACKAGE_VERSION='12.10.0' -PACKAGE_STRING='libindicator 12.10.0' +PACKAGE_VERSION='12.10.1' +PACKAGE_STRING='libindicator 12.10.1' PACKAGE_BUGREPORT='http://bugs.launchpad.net/libindicator' PACKAGE_URL='http://launchpad.net/libindicator' @@ -1355,7 +1355,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libindicator 12.10.0 to adapt to many kinds of systems. +\`configure' configures libindicator 12.10.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1425,7 +1425,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libindicator 12.10.0:";; + short | recursive ) echo "Configuration of libindicator 12.10.1:";; esac cat <<\_ACEOF @@ -1545,7 +1545,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libindicator configure 12.10.0 +libindicator configure 12.10.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1823,7 +1823,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libindicator $as_me 12.10.0, which was +It was created by libindicator $as_me 12.10.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2646,7 +2646,7 @@ fi # Define the identity of the package. PACKAGE='libindicator' - VERSION='12.10.0' + VERSION='12.10.1' cat >>confdefs.h <<_ACEOF @@ -13086,7 +13086,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libindicator $as_me 12.10.0, which was +This file was extended by libindicator $as_me 12.10.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13153,7 +13153,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libindicator config.status 12.10.0 +libindicator config.status 12.10.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index fd14287..6c34ad0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([libindicator], - [12.10.0], + [12.10.1], [http://bugs.launchpad.net/libindicator], [libindicator], [http://launchpad.net/libindicator]) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index ca821af..ba2d377 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -113,9 +113,7 @@ static void get_property (GObject*, guint prop_id, GValue*, GParamSpec* ); /* entries' visibility */ static GList * get_entries_default (IndicatorObject*); static GList * get_all_entries (IndicatorObject*); -static void entry_being_removed_default (IndicatorObject*, IndicatorObjectEntry*); static void indicator_object_entry_being_removed (IndicatorObject*, IndicatorObjectEntry*); -static void entry_was_added_default (IndicatorObject*, IndicatorObjectEntry*); static void indicator_object_entry_was_added (IndicatorObject*, IndicatorObjectEntry*); static IndicatorObjectEntryPrivate * entry_get_private (IndicatorObject*, IndicatorObjectEntry*); @@ -141,8 +139,8 @@ indicator_object_class_init (IndicatorObjectClass *klass) klass->get_accessible_desc = NULL; klass->get_entries = get_entries_default; klass->get_location = NULL; - klass->entry_being_removed = entry_being_removed_default; - klass->entry_was_added = entry_was_added_default; + klass->entry_being_removed = NULL; + klass->entry_was_added = NULL; klass->entry_activate = NULL; klass->entry_activate_window = NULL; @@ -937,61 +935,3 @@ set_property (GObject * object, } } -/*** -**** -***/ - -/* Cloaked entries are ones which are hidden but may be re-added later. - They are reffed + unparented so that they'll survive even if the - rest of the widgetry is destroyed */ -#define CLOAKED_KEY "entry-is-cloaked" - -static void -decloak_widget (gpointer w) -{ - if (w != NULL) { - GObject * o = G_OBJECT(w); - if (g_object_steal_data (o, CLOAKED_KEY) != NULL) { - g_object_unref (o); - } - } -} - -static void -entry_was_added_default (IndicatorObject * io, IndicatorObjectEntry * entry) -{ - decloak_widget (entry->image); - decloak_widget (entry->label); - decloak_widget (entry->menu); -} - -static void -cloak_widget (gpointer w) -{ - if (w != NULL) { - GtkWidget * parent; - - /* tag this object as cloaked */ - GObject * o = G_OBJECT(w); - g_object_ref (o); - g_object_set_data (o, CLOAKED_KEY, GINT_TO_POINTER(1)); - - /* remove it from its surrounding widgetry */ - if(GTK_IS_MENU(w)) { - if (gtk_menu_get_attach_widget (GTK_MENU(w)) != NULL) { - gtk_menu_detach (GTK_MENU(w)); - } - } - else if((parent = gtk_widget_get_parent(w))) { - gtk_container_remove(GTK_CONTAINER(parent), w); - } - } -} - -static void -entry_being_removed_default (IndicatorObject * io, IndicatorObjectEntry * entry) -{ - cloak_widget (entry->image); - cloak_widget (entry->label); - cloak_widget (entry->menu); -} diff --git a/tests/dummy-indicator-visible.c b/tests/dummy-indicator-visible.c index 0bb9e89..42cb59c 100644 --- a/tests/dummy-indicator-visible.c +++ b/tests/dummy-indicator-visible.c @@ -88,17 +88,25 @@ G_DEFINE_TYPE (DummyIndicatorVisible, dummy_indicator_visible, INDICATOR_OBJECT_ static void dummy_indicator_entry_being_removed (IndicatorObject * io, IndicatorObjectEntry * entry) { + IndicatorObjectClass * indicator_object_class = INDICATOR_OBJECT_CLASS (dummy_indicator_visible_parent_class); + g_object_set_data(G_OBJECT(entry->label), "is-hidden", GINT_TO_POINTER(1)); - INDICATOR_OBJECT_CLASS(dummy_indicator_visible_parent_class)->entry_being_removed (io, entry); + if (indicator_object_class->entry_being_removed != NULL) { + indicator_object_class->entry_being_removed (io, entry); + } } static void dummy_indicator_entry_was_added (IndicatorObject * io, IndicatorObjectEntry * entry) { + IndicatorObjectClass * indicator_object_class = INDICATOR_OBJECT_CLASS (dummy_indicator_visible_parent_class); + g_object_steal_data(G_OBJECT(entry->label), "is-hidden"); - INDICATOR_OBJECT_CLASS(dummy_indicator_visible_parent_class)->entry_was_added (io, entry); + if (indicator_object_class->entry_was_added != NULL) { + indicator_object_class->entry_was_added (io, entry); + } } static void diff --git a/tests/test-loader.c b/tests/test-loader.c index 28c56aa..45901cb 100644 --- a/tests/test-loader.c +++ b/tests/test-loader.c @@ -156,22 +156,24 @@ test_loader_filename_dummy_signaler (void) static void visible_entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer box) { - // make a frame for the entry, and add the frame to the box - GtkWidget * frame = gtk_frame_new (NULL); - GtkWidget * child = GTK_WIDGET(entry->label); + GtkWidget * child = GTK_WIDGET (entry->label); g_assert (child != NULL); - gtk_container_add (GTK_CONTAINER(frame), child); - gtk_box_pack_start (GTK_BOX(box), frame, FALSE, FALSE, 0); - g_object_set_data (G_OBJECT(child), "frame-parent", frame); + + if (g_object_get_data (G_OBJECT(child), "frame-parent") == NULL) + { + GtkWidget * frame = gtk_frame_new (NULL); + gtk_container_add (GTK_CONTAINER(frame), child); + gtk_box_pack_start (GTK_BOX(box), frame, FALSE, FALSE, 0); + g_object_set_data (G_OBJECT(child), "frame-parent", frame); + } } static void visible_entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer box) { - // destroy this entry's frame - gpointer parent = g_object_steal_data (G_OBJECT(entry->label), "frame-parent"); - if (GTK_IS_WIDGET(parent)) - gtk_widget_destroy(GTK_WIDGET(parent)); + GtkWidget * child = GTK_WIDGET (entry->label); + g_assert (child != NULL); + g_assert (g_object_get_data (G_OBJECT(child), "frame-parent") != NULL); } void @@ -218,7 +220,7 @@ test_loader_filename_dummy_visible (void) g_assert(GTK_IS_LABEL(label)); g_assert(g_object_get_qdata(G_OBJECT(label), is_hidden_quark) != NULL); list = gtk_container_get_children (GTK_CONTAINER(box)); - g_assert(g_list_length(list) == 0); + g_assert(g_list_length(list) == 1); g_list_free(list); // restore the entries and confirm that the label survived diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c index 10952dc..560fc45 100644 --- a/tools/indicator-loader.c +++ b/tools/indicator-loader.c @@ -25,6 +25,8 @@ License along with this library. If not, see #include <gtk/gtk.h> #include <libindicator/indicator-object.h> +static GHashTable * entry_to_menuitem = NULL; + #define ENTRY_DATA_NAME "indicator-custom-entry-data" static void @@ -40,20 +42,18 @@ activate_entry (GtkWidget * widget, gpointer user_data) return; } -static void -entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data) +static GtkWidget* +create_menu_item (IndicatorObjectEntry * entry) { - g_debug("Signal: Entry Added"); + GtkWidget * hbox; + GtkWidget * menuitem; - if (entry->parent_object == NULL) { - g_warning("Entry '%p' does not have a parent object", entry); - } + menuitem = gtk_menu_item_new(); - GtkWidget * menuitem = gtk_menu_item_new(); #if GTK_CHECK_VERSION(3,0,0) - GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3); #else - GtkWidget * hbox = gtk_hbox_new(FALSE, 3); + hbox = gtk_hbox_new(FALSE, 3); #endif if (entry->image != NULL) { @@ -69,26 +69,34 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_d gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu)); } - g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(activate_entry), io); - - gtk_menu_shell_append(GTK_MENU_SHELL(user_data), menuitem); - gtk_widget_show(menuitem); - - g_object_set_data(G_OBJECT(menuitem), ENTRY_DATA_NAME, entry); - - return; + return menuitem; } static void -entry_removed_cb (GtkWidget * widget, gpointer userdata) +entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data) { - gpointer data = g_object_get_data(G_OBJECT(widget), ENTRY_DATA_NAME); + GtkWidget * menuitem; + + g_debug("Signal: Entry Added"); - if (data != userdata) { - return; + if (entry->parent_object == NULL) { + g_warning("Entry '%p' does not have a parent object", entry); } - gtk_widget_destroy(widget); + menuitem = g_hash_table_lookup (entry_to_menuitem, entry); + if (menuitem == NULL) { + g_debug ("This is the first time this entry's been added -- creating a new menuitem for it"); + menuitem = create_menu_item (entry); + g_hash_table_insert (entry_to_menuitem, entry, menuitem); + + g_object_set_data(G_OBJECT(menuitem), ENTRY_DATA_NAME, entry); + g_signal_connect (G_OBJECT(menuitem), "activate", G_CALLBACK(activate_entry), io); + + gtk_menu_shell_append (GTK_MENU_SHELL(user_data), menuitem); + + } + gtk_widget_show (menuitem); + return; } @@ -97,7 +105,9 @@ entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user { g_debug("Signal: Entry Removed"); - gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry); + GtkWidget * menuitem = g_hash_table_lookup (entry_to_menuitem, entry); + if (menuitem != NULL) + gtk_widget_hide (menuitem); return; } @@ -162,6 +172,8 @@ main (int argc, char ** argv) gtk_init(&argc, &argv); + entry_to_menuitem = g_hash_table_new (g_direct_hash, g_direct_equal); + if (argc != 2) { g_error("Need filename"); return 1; @@ -183,5 +195,6 @@ main (int argc, char ** argv) gtk_main(); + g_hash_table_destroy (entry_to_menuitem); return 0; } |