[Xfce4-commits] <xfce4-taskbar-plugin:master> Merge branch 'master' of ssh://git.xfce.org/panel-plugins/xfce4-taskbar-plugin

Gearoid Murphy noreply at xfce.org
Sat Sep 22 13:40:02 CEST 2012


Updating branch refs/heads/master
         to aa010f398cf8aff6657a5be73589f5b75fa367af (commit)
       from b815f5d868d91f0af0b3622c3b69700b149721ed (commit)

commit aa010f398cf8aff6657a5be73589f5b75fa367af
Merge: b815f5d adba07c
Author: Gearoid Murphy <gearoid at murphy.com>
Date:   Mon Jan 9 19:52:39 2012 +0000

    Merge branch 'master' of ssh://git.xfce.org/panel-plugins/xfce4-taskbar-plugin

commit adba07c655d8cc2daedfbdde2618d1a9a0446ca6
Author: Gearoid Murphy <gearoid.murphy at hp.com>
Date:   Mon Jan 9 14:20:54 2012 +0000

    Refactored the Wnck class name grouping logic.

commit 09fbb4c7313f72e1de9934da50fb26cf56a7ddad
Author: Gearoid Murphy <gearoid.murphy at hp.com>
Date:   Wed Jan 4 10:28:00 2012 +0000

    Using the correct wnck window class name now.

commit cada864a495dd18449d80e1b2d4e1ef1aae420ad
Author: Gearoid Murphy <gearoid.murphy at hp.com>
Date:   Tue Jan 3 14:35:08 2012 +0000

    Added tooltips based on the Wnck window class name.

 taskbar-widget.c |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/taskbar-widget.c b/taskbar-widget.c
index b2d5bc3..5215191 100644
--- a/taskbar-widget.c
+++ b/taskbar-widget.c
@@ -93,7 +93,7 @@ struct _XfceTaskBar
     GSList *skipped_windows;
 
     /* classgroups of all the windows in the taskbar */
-    GHashTable *class_groups;
+    GHashTable *groups;
 
     /* size of the panel pluin */
     gint size;
@@ -163,7 +163,7 @@ struct _XfceTaskBarWNode
     GtkWidget           *label;
 
     WnckWindow          *window;
-    WnckClassGroup      *class_group;
+    gchar               *group_name;
     XfceTaskBarGroup    *group ;
     
     gboolean            visible ;
@@ -232,6 +232,9 @@ static void     xfce_taskbar_group_update_visibility        (XfceTaskBarGroup *g
 static void     xfce_taskbar_group_button_remove            (XfceTaskBarGroup *group);
 static void     xfce_taskbar_group_button_add_window        (XfceTaskBarGroup *group, XfceTaskBarWNode *window_child);
 
+static XfceTaskBarGroup* 
+                xfce_taskbar_group_button_new               (const char *, XfceTaskBar *taskbar);
+
 /* pinning functions */
 static void     xfce_taskbar_group_button_toggle_pinned     (XfceTaskBarGroup *group);
 static void     xfce_taskbar_group_button_launch_pinned     (XfceTaskBarGroup *group);
@@ -239,7 +242,7 @@ static void     xfce_taskbar_group_button_build_launch_menu (XfceTaskBarGroup *g
 static void     xfce_taskbar_group_button_build_pin_menu    (XfceTaskBarGroup *group, GtkWidget *menu);
 static void     cache_pinned_configuration                  (XfceTaskBar *taskbar);
 
-static XfceTaskBarGroup* xfce_taskbar_group_button_new  (const char *, XfceTaskBar *taskbar);
+
 
 /* potential public functions */
 static void xfce_taskbar_set_include_all_workspaces     (XfceTaskBar *taskbar, gboolean all_workspaces);
@@ -328,8 +331,8 @@ static void xfce_taskbar_init (XfceTaskBar *taskbar)
     taskbar->menu_icon_size = DEFAULT_MENU_ICON_SIZE;
     taskbar->menu_max_width_chars = DEFAULT_MENU_MAX_WIDTH_CHARS;
     
-    //taskbar->class_groups = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
-    taskbar->class_groups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
+    //taskbar->groups = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
+    taskbar->groups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
 }
 
 static void xfce_taskbar_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
@@ -458,7 +461,7 @@ void xfce_taskbar_load_pinned_config (XfceTaskBar *taskbar)
         
         //add in the icon and add it to the list of groups
         xfce_panel_image_set_from_pixbuf (XFCE_PANEL_IMAGE (group->icon), group->pixbuf);
-        g_hash_table_insert (taskbar->class_groups, (gpointer)group->window_class_name, group);
+        g_hash_table_insert (taskbar->groups, (gpointer)group->window_class_name, group);
         
         xfce_taskbar_group_update_visibility(group);
         
@@ -541,7 +544,7 @@ static void xfce_taskbar_finalize (GObject *object)
     }
 
     /* free the class group hash table */
-    g_hash_table_destroy (taskbar->class_groups);
+    g_hash_table_destroy (taskbar->groups);
     
 #ifdef GDK_WINDOWING_X11
     /* destroy the wireframe window */
@@ -881,7 +884,7 @@ static void xfce_taskbar_disconnect_screen (XfceTaskBar *taskbar)
     g_signal_handlers_disconnect_by_func (G_OBJECT (taskbar->gdk_screen), G_CALLBACK (xfce_taskbar_gdk_screen_changed), taskbar);
 
     /* delete all known class groups (and their buttons) */
-    g_hash_table_remove_all (taskbar->class_groups);
+    g_hash_table_remove_all (taskbar->groups);
 
     /* disconnect from all skipped windows */
     for (li = taskbar->skipped_windows; li != NULL; li = lnext)
@@ -1000,7 +1003,7 @@ static void xfce_taskbar_window_added (WnckScreen *screen, WnckWindow *window, X
     panel_return_if_fail (XFCE_IS_taskbar (taskbar));
     panel_return_if_fail (taskbar->screen == screen);
     panel_return_if_fail (wnck_window_get_screen (window) == screen);
-    panel_return_if_fail (wnck_window_get_class_group(window) != NULL);
+    panel_return_if_fail (wnck_window_get_application(window) != NULL);
     
     /* ignore this window, but watch it for state changes */
     if (wnck_window_is_skip_tasklist (window))
@@ -1013,18 +1016,18 @@ static void xfce_taskbar_window_added (WnckScreen *screen, WnckWindow *window, X
     /* create new window button */
     wnode = xfce_taskbar_wnode_new (window, taskbar);
     
-    g_hash_table_lookup_extended (taskbar->class_groups, wnck_class_group_get_res_class(wnode->class_group), NULL, (gpointer *) &group);
+    g_hash_table_lookup_extended (taskbar->groups, wnode->group_name, NULL, (gpointer *) &group);
 
     if (group == NULL)
     {
         /* create group button for this window and add it */
-        group = xfce_taskbar_group_button_new (wnck_class_group_get_res_class(wnode->class_group), taskbar);
+        group = xfce_taskbar_group_button_new (wnode->group_name, taskbar);
         
         group->pixbuf = wnck_window_get_icon (window);
         g_object_ref(group->pixbuf);
         
         xfce_panel_image_set_from_pixbuf (XFCE_PANEL_IMAGE (group->icon), group->pixbuf);
-        g_hash_table_insert (taskbar->class_groups, (gpointer)group->window_class_name, group);
+        g_hash_table_insert (taskbar->groups, (gpointer)group->window_class_name, group);
     }
     
     wnode->group = group ;
@@ -1822,7 +1825,7 @@ static void xfce_taskbar_wnode_del (XfceTaskBarWNode *wnode)
     g_signal_handlers_disconnect_matched (G_OBJECT (wnode->window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, wnode);
     gtk_widget_destroy (wnode->icon);
     gtk_widget_destroy (wnode->label);
-    g_object_unref (G_OBJECT (wnode->class_group));
+    g_free(wnode->group_name);
     g_slice_free (XfceTaskBarWNode, wnode);
 }
 
@@ -1841,9 +1844,7 @@ static XfceTaskBarWNode * xfce_taskbar_wnode_new (WnckWindow *window, XfceTaskBa
     wnode->icon = xfce_panel_image_new ();
     wnode->label = gtk_label_new (NULL);
     wnode->window = window;
-    wnode->class_group = wnck_window_get_class_group (window);
-    /* we need to ref the class group else the value returned from wnck_window_get_class_group() is null */
-    g_object_ref (G_OBJECT (wnode->class_group));
+    wnode->group_name = g_strdup(wnck_application_get_name(wnck_window_get_application (window)));
     wnode->visible = xfce_taskbar_button_visible(wnode, active_ws);
     
     /* monitor window changes */
@@ -2421,7 +2422,7 @@ static void xfce_taskbar_group_button_remove (XfceTaskBarGroup *group)
         if(gnode == group)
         {
             group->taskbar->wgroups = g_list_delete_link(group->taskbar->wgroups, gi);
-            g_hash_table_remove(group->taskbar->class_groups, (gpointer)group->window_class_name);
+            g_hash_table_remove(group->taskbar->groups, (gpointer)group->window_class_name);
             g_free(group->window_class_name);
             g_slice_free (XfceTaskBarGroup, group);
             return ;
@@ -2434,7 +2435,7 @@ static void xfce_taskbar_group_button_remove (XfceTaskBarGroup *group)
 static void xfce_taskbar_group_button_add_window (XfceTaskBarGroup *group, XfceTaskBarWNode *wnode)
 {
     panel_return_if_fail (WNCK_IS_WINDOW (wnode->window));
-    panel_return_if_fail (strcmp(wnck_class_group_get_res_class(wnode->class_group), group->window_class_name) == 0);
+    panel_return_if_fail (strcmp(wnode->group_name, group->window_class_name) == 0);
     panel_return_if_fail (XFCE_IS_taskbar (group->taskbar));
     panel_return_if_fail (g_slist_find (group->wnodes, wnode) == NULL);
 
@@ -2445,7 +2446,7 @@ static void xfce_taskbar_group_button_add_window (XfceTaskBarGroup *group, XfceT
     xfce_taskbar_group_update_visibility(group);
 }
 
-static XfceTaskBarGroup * xfce_taskbar_group_button_new (const char *class_group_name, XfceTaskBar *taskbar)
+static XfceTaskBarGroup * xfce_taskbar_group_button_new (const char *group_name, XfceTaskBar *taskbar)
 {
     GdkPixbuf *pixbuf;
     XfceTaskBarGroup *group;
@@ -2455,7 +2456,7 @@ static XfceTaskBarGroup * xfce_taskbar_group_button_new (const char *class_group
     group = g_slice_new0 (XfceTaskBarGroup);
     group->taskbar = taskbar;
     group->unique_id = taskbar->unique_id_counter++;
-    group->window_class_name = g_strdup(class_group_name);
+    group->window_class_name = g_strdup(group_name);
     
     
     //Prep the pinning data
@@ -2464,6 +2465,7 @@ static XfceTaskBarGroup * xfce_taskbar_group_button_new (const char *class_group
     
     group->button = xfce_arrow_button_new (GTK_ARROW_NONE);
     gtk_widget_set_parent (group->button, GTK_WIDGET (taskbar));
+    gtk_widget_set_tooltip_text (group->button, group_name);
     group->icon = xfce_panel_image_new ();
     group->align = gtk_alignment_new(0.5, 0.5, 0, 0);
     gtk_container_add( GTK_CONTAINER(group->align), group->icon);


More information about the Xfce4-commits mailing list