[Xfce4-commits] r24246 - xfce4-panel/branches/4_5_nick/plugins/tasklist

Nick Schermer nick at xfce.org
Tue Jan 2 20:27:55 CET 2007


Author: nick
Date: 2007-01-02 19:27:55 +0000 (Tue, 02 Jan 2007)
New Revision: 24246

Added:
   xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.c
   xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.h
   xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.h
Modified:
   xfce4-panel/branches/4_5_nick/plugins/tasklist/Makefile.am
   xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.c
Log:
Move dialog functions in a separate file. The library size hardly increases.


Modified: xfce4-panel/branches/4_5_nick/plugins/tasklist/Makefile.am
===================================================================
--- xfce4-panel/branches/4_5_nick/plugins/tasklist/Makefile.am	2007-01-02 19:25:57 UTC (rev 24245)
+++ xfce4-panel/branches/4_5_nick/plugins/tasklist/Makefile.am	2007-01-02 19:27:55 UTC (rev 24246)
@@ -13,7 +13,10 @@
 	libtasklist.la
 
 libtasklist_la_SOURCES = 						\
-	tasklist.c
+	tasklist.c							\
+	tasklist.h							\
+	tasklist-dialogs.c						\
+	tasklist-dialogs.h
 
 libtasklist_la_CFLAGS =							\
 	$(GTK_CFLAGS)							\

Added: xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.c
===================================================================
--- xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.c	                        (rev 0)
+++ xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.c	2007-01-02 19:27:55 UTC (rev 24246)
@@ -0,0 +1,230 @@
+/*  $Id$
+ *
+ *  Copyright © 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Library General Public License as published
+ *  by the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "tasklist.h"
+#include "tasklist-dialogs.h"
+
+static void
+all_workspaces_toggled (GtkToggleButton *tb,
+                        Tasklist        *tasklist)
+{
+    tasklist->all_workspaces = gtk_toggle_button_get_active (tb);
+
+    netk_tasklist_set_include_all_workspaces (NETK_TASKLIST (tasklist->list),
+                                              tasklist->all_workspaces);
+}
+
+
+
+static void
+grouping_changed (GtkComboBox *cb,
+                  Tasklist    *tasklist)
+{
+    tasklist->grouping = gtk_combo_box_get_active (cb);
+
+    netk_tasklist_set_grouping (NETK_TASKLIST (tasklist->list),
+                                tasklist->grouping);
+}
+
+
+
+static void
+show_label_toggled (GtkToggleButton *tb,
+                    Tasklist        *tasklist)
+{
+    tasklist->show_label = gtk_toggle_button_get_active (tb);
+
+    netk_tasklist_set_show_label (NETK_TASKLIST (tasklist->list),
+                                  tasklist->show_label);
+}
+
+
+
+static void
+expand_toggled (GtkToggleButton *tb,
+                Tasklist        *tasklist)
+{
+    tasklist->expand = gtk_toggle_button_get_active (tb);
+
+    xfce_panel_plugin_set_expand (tasklist->plugin, tasklist->expand);
+}
+
+
+
+static void
+flat_buttons_toggled (GtkToggleButton *tb,
+                      Tasklist        *tasklist)
+{
+    tasklist->flat_buttons = gtk_toggle_button_get_active (tb);
+
+    netk_tasklist_set_button_relief (NETK_TASKLIST (tasklist->list),
+                                     tasklist->flat_buttons ?
+                                        GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
+}
+
+
+
+static void
+show_handles_toggled (GtkToggleButton *tb,
+                      Tasklist        *tasklist)
+{
+    tasklist->show_handles = gtk_toggle_button_get_active (tb);
+
+    if (tasklist->show_handles)
+    	gtk_widget_show (tasklist->handle);
+    else
+    	gtk_widget_hide (tasklist->handle);
+}
+
+
+
+static void
+width_changed (GtkSpinButton *sb,
+               Tasklist      *tasklist)
+{
+    tasklist->width = gtk_spin_button_get_value_as_int (sb);
+
+    tasklist_set_size (tasklist, xfce_panel_plugin_get_size (tasklist->plugin));
+}
+
+
+
+static void
+tasklist_dialog_response (GtkWidget *dlg,
+                          gint       reponse,
+                          Tasklist  *tasklist)
+{
+    g_object_set_data (G_OBJECT (tasklist->plugin), "dialog", NULL);
+
+    gtk_widget_destroy (dlg);
+    xfce_panel_plugin_unblock_menu (tasklist->plugin);
+    tasklist_write_rc_file (tasklist);
+}
+
+
+
+void
+tasklist_properties_dialog (Tasklist *tasklist)
+{
+    GtkWidget *dlg, *mainvbox, *vbox, *frame, *cb,
+              *hbox, *label, *spin;
+
+    xfce_panel_plugin_block_menu (tasklist->plugin);
+
+    dlg = xfce_titled_dialog_new_with_buttons (_("Task List"), NULL,
+                GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+                GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+                NULL);
+
+    gtk_window_set_screen (GTK_WINDOW (dlg),
+                           gtk_widget_get_screen (GTK_WIDGET (tasklist->plugin)));
+
+    g_object_set_data (G_OBJECT (tasklist->plugin), "dialog", dlg);
+
+    gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
+    gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings");
+
+    g_signal_connect (G_OBJECT (dlg), "response",
+                      G_CALLBACK (tasklist_dialog_response), tasklist);
+
+    gtk_container_set_border_width (GTK_CONTAINER (dlg), 2);
+
+    mainvbox = gtk_vbox_new (FALSE, 8);
+    gtk_container_set_border_width (GTK_CONTAINER (mainvbox), 5);
+    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), mainvbox,
+                        TRUE, TRUE, 0);
+
+    /* Size */
+    vbox = gtk_vbox_new (FALSE, 8);
+
+    frame = xfce_create_framebox_with_content (_("Appearance"), vbox);
+    gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
+
+    hbox = gtk_hbox_new (FALSE, 8);
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+
+    label = gtk_label_new (_("Minimum Width:"));
+    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+    /* an arbitrary max of 4000 should be future proof, right? */
+    spin = gtk_spin_button_new_with_range (100, 4000, 10);
+    gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0);
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), tasklist->width);
+    g_signal_connect (spin, "value-changed", G_CALLBACK (width_changed),
+                      tasklist);
+
+    if (tasklist_using_xinerama (tasklist->plugin))
+    {
+        cb = gtk_check_button_new_with_mnemonic (_("Use all available space"));
+        gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->expand);
+        g_signal_connect (G_OBJECT (cb), "toggled",
+                          G_CALLBACK (expand_toggled), tasklist);
+    }
+
+    cb = gtk_check_button_new_with_mnemonic (_("Use flat buttons"));
+    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->flat_buttons);
+    g_signal_connect (G_OBJECT (cb), "toggled",
+                      G_CALLBACK (flat_buttons_toggled), tasklist);
+
+    cb = gtk_check_button_new_with_mnemonic (_("Show handles"));
+    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_handles);
+    g_signal_connect (G_OBJECT (cb), "toggled",
+                      G_CALLBACK (show_handles_toggled), tasklist);
+
+    /* Tasks */
+    vbox = gtk_vbox_new (FALSE, 8);
+
+    frame = xfce_create_framebox_with_content (_("Task List"), vbox);
+    gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
+
+    cb = gtk_check_button_new_with_mnemonic (_("Show tasks from _all workspaces"));
+    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->all_workspaces);
+    g_signal_connect (G_OBJECT (cb), "toggled",
+                      G_CALLBACK (all_workspaces_toggled), tasklist);
+
+    cb = gtk_check_button_new_with_mnemonic (_("Show application _names"));
+    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_label);
+    g_signal_connect (G_OBJECT (cb), "toggled",
+                      G_CALLBACK (show_label_toggled), tasklist);
+
+    cb = gtk_combo_box_new_text ();
+    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
+
+    /* keep order in sync with NetkTasklistGroupingType */
+    gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Never group tasks"));
+    gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Automatically group tasks"));
+    gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Always group tasks"));
+
+    gtk_combo_box_set_active (GTK_COMBO_BOX (cb), tasklist->grouping);
+
+    g_signal_connect (G_OBJECT (cb), "changed",
+                      G_CALLBACK (grouping_changed), tasklist);
+
+    gtk_widget_show_all (dlg);
+}

Added: xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.h
===================================================================
--- xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.h	                        (rev 0)
+++ xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist-dialogs.h	2007-01-02 19:27:55 UTC (rev 24246)
@@ -0,0 +1,26 @@
+/*  $Id$
+ *
+ *  Copyright © 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Library General Public License as published
+ *  by the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TASKLIST_DIALOGS_H__
+#define __TASKLIST_DIALOGS_H__
+
+void
+tasklist_properties_dialog (Tasklist *tasklist) G_GNUC_INTERNAL;
+
+#endif /* !__TASKLIST_DIALOGS_H__ */

Modified: xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.c
===================================================================
--- xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.c	2007-01-02 19:25:57 UTC (rev 24245)
+++ xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.c	2007-01-02 19:27:55 UTC (rev 24246)
@@ -1,8 +1,6 @@
-/* vim: set expandtab ts=8 sw=4: */
-
 /*  $Id$
  *
- *  Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ *  Copyright © 2005-2007 Jasper Huijsmans <jasper at xfce.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU Library General Public License as published
@@ -23,46 +21,34 @@
 #include <config.h>
 #endif
 
-#include <gtk/gtk.h>
-
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
-#include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4panel/xfce-hvbox.h>
 
-typedef struct
-{
-    XfcePanelPlugin          *plugin;
+#include "tasklist.h"
+#include "tasklist-dialogs.h"
 
-    GtkWidget                *box;
-    GtkWidget                *handle;
-    GtkWidget                *list;
 
-    gint                      width;
-    gint                      screen_changed_id;
+/* prototypes */
+static void        tasklist_orientation_changed     (Tasklist       *tasklist,
+                                                     GtkOrientation  orientation);
+static gboolean    tasklist_set_size                (Tasklist       *tasklist,
+                                                     gint             size);
+static void        tasklist_free_data               (Tasklist        *tasklist);
+static void        tasklist_read_rc_file            (Tasklist        *tasklist);
+static gboolean    tasklist_handle_exposed          (GtkWidget       *widget,
+                                                     GdkEventExpose  *ev,
+                                                     Tasklist        *tasklist);
+static void        tasklist_screen_changed          (Tasklist        *tasklist,
+                                                     GdkScreen       *screen);
+static void        tasklist_construct               (XfcePanelPlugin *plugin);
 
-    NetkTasklistGroupingType  grouping;
-    guint                     all_workspaces : 1;
-    guint                     show_label : 1;
-    guint                     expand : 1;
-    guint                     flat_buttons : 1;
-    guint                     show_handles : 1;
-}
-Tasklist;
 
-/* prototypes */
-static void      tasklist_properties_dialog  (Tasklist        *tasklist);
-static void      tasklist_construct          (XfcePanelPlugin *plugin);
-static gboolean  using_xinerama              (XfcePanelPlugin *plugin);
 
 /* register with the panel */
 XFCE_PANEL_PLUGIN_REGISTER_INTERNAL (tasklist_construct);
 
 
 
-/**
- * Interface Implementation
- **/
 static void
 tasklist_orientation_changed (Tasklist       *tasklist,
                               GtkOrientation  orientation)
@@ -107,7 +93,10 @@
     if (G_UNLIKELY (dlg))
         gtk_widget_destroy (dlg);
 
-    g_signal_handler_disconnect (G_OBJECT (tasklist->plugin), tasklist->screen_changed_id);
+    /* disconnect the screen changed signal */
+    g_signal_handler_disconnect (G_OBJECT (tasklist->plugin),
+                                 tasklist->screen_changed_id);
+                                 
     panel_slice_free (Tasklist, tasklist);
 }
 
@@ -143,7 +132,7 @@
             tasklist->show_handles   = xfce_rc_read_bool_entry (rc, "show_handles", tasklist->show_handles);
             tasklist->width          = xfce_rc_read_int_entry (rc, "width",tasklist->width);
 
-            if (using_xinerama (tasklist->plugin))
+            if (tasklist_using_xinerama (tasklist->plugin))
                 tasklist->expand = xfce_rc_read_int_entry (rc, "expand", tasklist->expand);
 
             xfce_rc_close (rc);
@@ -153,7 +142,7 @@
 
 
 
-static void
+void
 tasklist_write_rc_file (Tasklist *tasklist)
 {
     gchar  *file;
@@ -184,11 +173,10 @@
 
 
 
-/* create widgets and connect to signals */
 static gboolean
-handle_expose (GtkWidget      *widget,
-               GdkEventExpose *ev,
-               Tasklist       *tasklist)
+tasklist_handle_exposed (GtkWidget      *widget,
+                         GdkEventExpose *ev,
+                         Tasklist       *tasklist)
 {
     GtkAllocation  *allocation = &(widget->allocation);
     gint            x, y, w, h;
@@ -228,15 +216,30 @@
 
 
 
+gboolean
+tasklist_using_xinerama (XfcePanelPlugin *plugin)
+{
+    return (gdk_screen_get_n_monitors (gtk_widget_get_screen (GTK_WIDGET (plugin))) > 1);
+}
+
+
+
 static void
 tasklist_screen_changed (Tasklist  *tasklist,
                          GdkScreen *screen)
 {
-    if (!screen)
-        return;
+	NetkScreen *ns;
+	
+	/* get the new screen */
+	screen = gtk_widget_get_screen (GTK_WIDGET (tasklist->plugin));
+	
+	/* be secure */
+    if (G_UNLIKELY (screen == NULL))
+        screen = gdk_screen_get_default ();
+        
+    ns = netk_screen_get (gdk_screen_get_number (screen));
 
-    netk_tasklist_set_screen (NETK_TASKLIST (tasklist->list),
-            netk_screen_get (gdk_screen_get_number (screen)));
+    netk_tasklist_set_screen (NETK_TASKLIST (tasklist->list), ns);
 }
 
 
@@ -250,6 +253,7 @@
 
     tasklist->plugin = plugin;
 
+    /* show the properties menu item in the right-click menu */
     xfce_panel_plugin_menu_show_configure (plugin);
 
     /* connect panel signals */
@@ -281,252 +285,31 @@
     gtk_box_pack_start (GTK_BOX (tasklist->box), tasklist->handle, FALSE, FALSE, 0);
     xfce_panel_plugin_add_action_widget (plugin, tasklist->handle);
     g_signal_connect (tasklist->handle, "expose-event",
-                      G_CALLBACK (handle_expose), tasklist);
+                      G_CALLBACK (tasklist_handle_exposed), tasklist);
 
     /* create netk tasklist */
     screen = gtk_widget_get_screen (GTK_WIDGET (plugin));
     screen_idx = gdk_screen_get_number (screen);
     tasklist->list = netk_tasklist_new (netk_screen_get (screen_idx));
     gtk_widget_show (tasklist->list);
-    gtk_box_pack_start (GTK_BOX (tasklist->box), tasklist->list,
-                        TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (tasklist->box), tasklist->list, TRUE, TRUE, 0);
 
     /* show the handles */
     if (tasklist->show_handles)
         gtk_widget_show (tasklist->handle);
 
-
     /* set netk tasklist settings */
     netk_tasklist_set_include_all_workspaces (NETK_TASKLIST (tasklist->list),
                                               tasklist->all_workspaces);
-    netk_tasklist_set_grouping (NETK_TASKLIST (tasklist->list),
-                                tasklist->grouping);
-    netk_tasklist_set_show_label (NETK_TASKLIST (tasklist->list),
-                                  tasklist->show_label);
-    netk_tasklist_set_button_relief (NETK_TASKLIST (tasklist->list),
-                                     tasklist->flat_buttons ?
-                                        GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
+    netk_tasklist_set_grouping               (NETK_TASKLIST (tasklist->list),
+                                              tasklist->grouping);
+    netk_tasklist_set_show_label             (NETK_TASKLIST (tasklist->list),
+                                              tasklist->show_label);
+    netk_tasklist_set_button_relief          (NETK_TASKLIST (tasklist->list),
+                                              tasklist->flat_buttons ? GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
 
     /* connect screen changed signal */
     tasklist->screen_changed_id =
         g_signal_connect_swapped (G_OBJECT (plugin), "screen-changed",
                                   G_CALLBACK (tasklist_screen_changed), tasklist);
 }
-
-
-
-/**
- * Configuration Dialog
- **/
-static void
-all_workspaces_toggled (GtkToggleButton *tb,
-                        Tasklist        *tasklist)
-{
-    tasklist->all_workspaces = gtk_toggle_button_get_active (tb);
-
-    netk_tasklist_set_include_all_workspaces (NETK_TASKLIST (tasklist->list),
-                                              tasklist->all_workspaces);
-}
-
-
-
-static void
-grouping_changed (GtkComboBox *cb,
-                  Tasklist    *tasklist)
-{
-    tasklist->grouping = gtk_combo_box_get_active (cb);
-
-    netk_tasklist_set_grouping (NETK_TASKLIST (tasklist->list),
-                                tasklist->grouping);
-}
-
-
-
-static void
-show_label_toggled (GtkToggleButton *tb,
-                    Tasklist        *tasklist)
-{
-    tasklist->show_label = gtk_toggle_button_get_active (tb);
-
-    netk_tasklist_set_show_label (NETK_TASKLIST (tasklist->list),
-                                  tasklist->show_label);
-}
-
-
-
-static void
-expand_toggled (GtkToggleButton *tb,
-                Tasklist        *tasklist)
-{
-    tasklist->expand = gtk_toggle_button_get_active (tb);
-
-    xfce_panel_plugin_set_expand (tasklist->plugin, tasklist->expand);
-}
-
-
-
-static void
-flat_buttons_toggled (GtkToggleButton *tb,
-                      Tasklist        *tasklist)
-{
-    tasklist->flat_buttons = gtk_toggle_button_get_active (tb);
-
-    netk_tasklist_set_button_relief (NETK_TASKLIST (tasklist->list),
-                                     tasklist->flat_buttons ?
-                                        GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
-}
-
-
-
-static void
-show_handles_toggled (GtkToggleButton *tb,
-                      Tasklist        *tasklist)
-{
-    tasklist->show_handles = gtk_toggle_button_get_active (tb);
-
-    if (tasklist->show_handles)
-    	gtk_widget_show (tasklist->handle);
-    else
-    	gtk_widget_hide (tasklist->handle);
-}
-
-
-
-static void
-width_changed (GtkSpinButton *sb,
-               Tasklist      *tasklist)
-{
-    tasklist->width = gtk_spin_button_get_value_as_int (sb);
-
-    tasklist_set_size (tasklist, xfce_panel_plugin_get_size (tasklist->plugin));
-}
-
-
-
-static void
-tasklist_dialog_response (GtkWidget *dlg,
-                          gint       reponse,
-                          Tasklist  *tasklist)
-{
-    g_object_set_data (G_OBJECT (tasklist->plugin), "dialog", NULL);
-
-    gtk_widget_destroy (dlg);
-    xfce_panel_plugin_unblock_menu (tasklist->plugin);
-    tasklist_write_rc_file (tasklist);
-}
-
-
-
-static void
-tasklist_properties_dialog (Tasklist *tasklist)
-{
-    GtkWidget *dlg, *mainvbox, *vbox, *frame, *cb,
-              *hbox, *label, *spin;
-
-    xfce_panel_plugin_block_menu (tasklist->plugin);
-
-    dlg = xfce_titled_dialog_new_with_buttons (_("Task List"), NULL,
-                GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
-                GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
-                NULL);
-
-    gtk_window_set_screen (GTK_WINDOW (dlg),
-                           gtk_widget_get_screen (GTK_WIDGET (tasklist->plugin)));
-
-    g_object_set_data (G_OBJECT (tasklist->plugin), "dialog", dlg);
-
-    gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
-    gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings");
-
-    g_signal_connect (G_OBJECT (dlg), "response",
-                      G_CALLBACK (tasklist_dialog_response), tasklist);
-
-    gtk_container_set_border_width (GTK_CONTAINER (dlg), 2);
-
-    mainvbox = gtk_vbox_new (FALSE, 8);
-    gtk_container_set_border_width (GTK_CONTAINER (mainvbox), 5);
-    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), mainvbox,
-                        TRUE, TRUE, 0);
-
-    /* Size */
-    vbox = gtk_vbox_new (FALSE, 8);
-
-    frame = xfce_create_framebox_with_content (_("Appearance"), vbox);
-    gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
-
-    hbox = gtk_hbox_new (FALSE, 8);
-    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
-    label = gtk_label_new (_("Minimum Width:"));
-    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
-    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
-    /* an arbitrary max of 4000 should be future proof, right? */
-    spin = gtk_spin_button_new_with_range (100, 4000, 10);
-    gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0);
-    gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), tasklist->width);
-    g_signal_connect (spin, "value-changed", G_CALLBACK (width_changed),
-                      tasklist);
-
-    if (using_xinerama (tasklist->plugin))
-    {
-        cb = gtk_check_button_new_with_mnemonic (_("Use all available space"));
-        gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->expand);
-        g_signal_connect (G_OBJECT (cb), "toggled",
-                          G_CALLBACK (expand_toggled), tasklist);
-    }
-
-    cb = gtk_check_button_new_with_mnemonic (_("Use flat buttons"));
-    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->flat_buttons);
-    g_signal_connect (G_OBJECT (cb), "toggled",
-                      G_CALLBACK (flat_buttons_toggled), tasklist);
-
-    cb = gtk_check_button_new_with_mnemonic (_("Show handles"));
-    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_handles);
-    g_signal_connect (G_OBJECT (cb), "toggled",
-                      G_CALLBACK (show_handles_toggled), tasklist);
-
-    /* Tasks */
-    vbox = gtk_vbox_new (FALSE, 8);
-
-    frame = xfce_create_framebox_with_content (_("Task List"), vbox);
-    gtk_box_pack_start (GTK_BOX (mainvbox), frame, FALSE, FALSE, 0);
-
-    cb = gtk_check_button_new_with_mnemonic (_("Show tasks from _all workspaces"));
-    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->all_workspaces);
-    g_signal_connect (G_OBJECT (cb), "toggled",
-                      G_CALLBACK (all_workspaces_toggled), tasklist);
-
-    cb = gtk_check_button_new_with_mnemonic (_("Show application _names"));
-    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_label);
-    g_signal_connect (G_OBJECT (cb), "toggled",
-                      G_CALLBACK (show_label_toggled), tasklist);
-
-    cb = gtk_combo_box_new_text ();
-    gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
-
-    /* keep order in sync with NetkTasklistGroupingType */
-    gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Never group tasks"));
-    gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Automatically group tasks"));
-    gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Always group tasks"));
-
-    gtk_combo_box_set_active (GTK_COMBO_BOX (cb), tasklist->grouping);
-
-    g_signal_connect (G_OBJECT (cb), "changed",
-                      G_CALLBACK (grouping_changed), tasklist);
-
-    gtk_widget_show_all (dlg);
-}
-
-
-
-static gboolean
-using_xinerama (XfcePanelPlugin *plugin)
-{
-    return (gdk_screen_get_n_monitors (gtk_widget_get_screen (GTK_WIDGET (plugin))) > 1);
-}

Added: xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.h
===================================================================
--- xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.h	                        (rev 0)
+++ xfce4-panel/branches/4_5_nick/plugins/tasklist/tasklist.h	2007-01-02 19:27:55 UTC (rev 24246)
@@ -0,0 +1,51 @@
+/*  $Id$
+ *
+ *  Copyright © 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Library General Public License as published
+ *  by the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TASKLIST_H__
+#define __TASKLIST_H__
+
+#include <gtk/gtk.h>
+#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4panel/xfce-panel-plugin.h>
+
+typedef struct _Tasklist Tasklist;
+
+struct _Tasklist
+{
+    XfcePanelPlugin          *plugin;
+
+    GtkWidget                *box;
+    GtkWidget                *handle;
+    GtkWidget                *list;
+
+    gint                      width;
+    gint                      screen_changed_id;
+
+    NetkTasklistGroupingType  grouping;
+    guint                     all_workspaces : 1;
+    guint                     show_label : 1;
+    guint                     expand : 1;
+    guint                     flat_buttons : 1;
+    guint                     show_handles : 1;
+};
+
+void        tasklist_write_rc_file           (Tasklist        *tasklist) G_GNUC_INTERNAL;
+gboolean    tasklist_using_xinerama          (XfcePanelPlugin *plugin)   G_GNUC_INTERNAL;
+
+#endif /* !__TASKLIST_H__ */



More information about the Xfce4-commits mailing list