taskbar items without label

Andre Lerche a.lerche at gmx.net
Sat Jun 26 20:09:05 CEST 2004


Hi,

via PM I was asked, if it is possible to optional have items
without the labels in the taskbar plugin.

I like the idea, cause there is the tooltip per item, and
the tasklist can display more items without grouping. But
this needs a libxfcegui4 patch.

The trivial patch is attached. Any different opinions ? If not,
commit it please.

Thanks,

Andre
-------------- next part --------------
--- netk-tasklist.c.orig	2004-06-26 19:26:28.081596136 +0200
+++ netk-tasklist.c	2004-06-26 19:21:19.944440104 +0200
@@ -150,6 +150,8 @@
     NetkLoadIconFunction icon_loader;
     void *icon_loader_data;
     GDestroyNotify free_icon_loader_data;
+
+    gboolean show_label;
 };
 
 
@@ -474,6 +476,20 @@
 }
 
 void
+netk_tasklist_set_show_label (NetkTasklist * tasklist,
+                              gboolean show_label)
+{ 
+    g_return_if_fail (NETK_IS_TASKLIST (tasklist));
+
+    if (tasklist->priv->show_label == show_label)
+        return;
+
+    tasklist->priv->show_label = show_label;
+    gtk_widget_queue_resize (GTK_WIDGET (tasklist));
+    netk_tasklist_update_lists (tasklist);
+}
+
+void
 netk_tasklist_set_grouping (NetkTasklist * tasklist,
                             NetkTasklistGroupingType grouping)
 {
@@ -1198,6 +1214,8 @@
 
     netk_tasklist_set_screen (tasklist, screen);
 
+    tasklist->priv->show_label=TRUE;
+
     return GTK_WIDGET (tasklist);
 }
 
@@ -1933,7 +1951,8 @@
     text = netk_task_get_text (task);
     if (text != NULL)
     {
-        gtk_label_set_text (GTK_LABEL (task->label), text);
+        if (task->tasklist->priv->show_label)
+	    gtk_label_set_text (GTK_LABEL (task->label), text);
         gtk_tooltips_set_tip (task->tasklist->priv->tooltips, task->button,
                               text, NULL);
         g_free (text);
@@ -2147,13 +2166,16 @@
     gtk_widget_show (task->image);
 
     text = netk_task_get_text (task);
-    task->label = gtk_label_new (text);
-    gtk_widget_show (task->label);
 
     gtk_table_attach (GTK_TABLE (table),
                       task->image, 0, 1, 0, 1, 0, GTK_EXPAND, 0, 0);
-    gtk_table_attach (GTK_TABLE (table),
+
+    if (task->tasklist->priv->show_label) {
+        task->label = gtk_label_new (text);
+        gtk_widget_show (task->label);
+        gtk_table_attach (GTK_TABLE (table),
                       task->label, 1, 2, 0, 1, GTK_EXPAND, GTK_EXPAND, 0, 0);
+    }
 
     gtk_container_add (GTK_CONTAINER (task->button), table);
     gtk_widget_show (table);
-------------- next part --------------
--- netk-tasklist.h.orig	2004-06-26 19:22:24.834575304 +0200
+++ netk-tasklist.h	2004-06-26 19:11:00.701579328 +0200
@@ -77,6 +77,8 @@
      void netk_tasklist_set_include_all_workspaces (NetkTasklist * tasklist,
 						    gboolean
 						    include_all_workspaces);
+     void netk_tasklist_set_show_label (NetkTasklist * tasklist,
+                                         gboolean show_label);
      void netk_tasklist_set_minimum_width (NetkTasklist * tasklist,
 					   gint size);
      gint netk_tasklist_get_minimum_width (NetkTasklist * tasklist);


More information about the Xfce4-dev mailing list