[Xfce4-commits] <xfce4-panel:devel> * Update NEWS. * Use -V for version information. * Make some more stuff work in the item manager.

Nick Schermer nick at xfce.org
Tue Aug 11 20:26:22 CEST 2009


Updating branch refs/heads/devel
         to 5dd9ca60e2eb7bd7237683b63063d81be924dd3f (commit)
       from aab284b08cf31164855f09b31c33f400f3c13566 (commit)

commit 5dd9ca60e2eb7bd7237683b63063d81be924dd3f
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Dec 7 12:19:42 2008 +0100

    * Update NEWS.
    * Use -V for version information.
    * Make some more stuff work in the item manager.

 NEWS                              |   30 +++++++++++++++++++++++
 libxfce4panel/xfce-panel-plugin.c |   30 ++++++++---------------
 panel/main.c                      |    2 +-
 panel/panel-application.c         |    1 -
 panel/panel-item-dialog.c         |    7 ++++-
 panel/panel-preferences-dialog.c  |   47 +++++++++++++++++++++++++++++--------
 6 files changed, 84 insertions(+), 33 deletions(-)

diff --git a/NEWS b/NEWS
index e69de29..18e6cae 100644
--- a/NEWS
+++ b/NEWS
@@ -0,0 +1,30 @@
+
+Panel
+=====
+- Almost complete rewrite of the code. Everything is now writtin in gobjects and a lot easier to understand (more comments, better function names, less code, smarter, faster, etc.).
+- Dragging a panel to snap to screen egdes (will work on a mouseless implementation later). Greatly improved the positioning code.
+- You can set the panel length (percentages).
+- Lock panels -> no dragging possible.
+- Alpha background (transparent panel).
+- Item/plugin editor in the panel preferences.
+- Xfconf, so you can change all panel properties externally except for adding and removing panels (yet).
+
+Plugin Framework
+================
+- ALL PLUGINS ARE FROM NOW ON COMPILED AS LIBRARIES. So you need to change your Makefile.am (sorry). Will provide a script to do this before compiling a plugin.
+- DBus communication with external plugins.
+- Plugins API is still the same (pfew).
+- If you want to run an external plugin you can define X-XFCE-External=TRUE in the desktop file. The panel will then start a plugin wrapper that embeds the plugin, so you have all the advanatages of the previous external plugin implementation (and I get something that is easy to maintain).
+- Because of the changes above, the XfcePanelPlugin is now a single gobject, this drops a lot of complexity in the previous plugin framework and also allows developing plugins as gobjects (yay).
+- Various speedups here and there.
+
+Internal Plugins
+================
+- Xfconf support in all plugins.
+- All plugins use the gobject implementation.
+- Iconbox: Merged in the tasklist plugins.
+- Clock: Fuzzy clock mode. Still working on some other improvements.
+- Tasklist: Dropped the WnckTasklist, to make the iconbox merge. Also working on some other improvements (sorting, dnd, performance, accessibility).
+- Launcher: Improve desktop file support, not started yet. In the end it should be a lot easier to create launchers.
+- Launcher: Create new launchers from the command line.
+
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index bb5ee79..90705ea 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -602,31 +602,23 @@ xfce_panel_plugin_menu_move (XfcePanelPlugin *plugin)
 static void
 xfce_panel_plugin_menu_remove (XfcePanelPlugin *plugin)
 {
-  GtkWidget *dialog;
+  GtkWidget *widget;
 
   panel_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
 
-  /* create question dialog */
-  dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION,
-                                   GTK_BUTTONS_NONE, _("Do you want to remove \"%s\"?"),
-                                   xfce_panel_plugin_get_display_name (plugin));
-
-  /* setup */
-  gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (GTK_WIDGET (plugin)));
-  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                            _("The item will be removed from the panel and "
-                                              "its configuration will be lost."));
-
-  /* add hig buttons */
-  gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
-                          GTK_STOCK_REMOVE, GTK_RESPONSE_YES, NULL);
-  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);
+  /* create question dialog (same code is also in panel-preferences-dialog.c) */
+  widget = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
+                                   _("Are you sure that you want to remove \"%s\"?"), xfce_panel_plugin_get_display_name (plugin));
+  gtk_window_set_screen (GTK_WINDOW (widget), gtk_widget_get_screen (GTK_WIDGET (plugin)));
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (widget), _("If you remove the item from the panel, it is permanently lost."));
+  gtk_dialog_add_buttons (GTK_DIALOG (widget), GTK_STOCK_CANCEL, GTK_RESPONSE_NO, GTK_STOCK_REMOVE, GTK_RESPONSE_YES, NULL);
+  gtk_dialog_set_default_response (GTK_DIALOG (widget), GTK_RESPONSE_NO);
 
   /* run the dialog */
-  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
+  if (gtk_dialog_run (GTK_DIALOG (widget)) == GTK_RESPONSE_YES)
     {
       /* hide the dialog */
-      gtk_widget_hide (dialog);
+      gtk_widget_hide (widget);
 
       /* ask the panel or wrapper to remove the plugin */
       xfce_panel_plugin_provider_emit_signal (XFCE_PANEL_PLUGIN_PROVIDER (plugin),
@@ -634,7 +626,7 @@ xfce_panel_plugin_menu_remove (XfcePanelPlugin *plugin)
     }
 
   /* destroy */
-  gtk_widget_destroy (dialog);
+  gtk_widget_destroy (widget);
 }
 
 
diff --git a/panel/main.c b/panel/main.c
index f64ed57..260c18d 100644
--- a/panel/main.c
+++ b/panel/main.c
@@ -75,7 +75,7 @@ static GOptionEntry option_entries[] =
   { "add", '\0', 0, G_OPTION_ARG_STRING, &opt_add, N_("Add a new plugin to the panel"), N_("PLUGIN NAME") },
   { "restart", 'r', 0, G_OPTION_ARG_NONE, &opt_restart, N_("Restart the running panel instance"), NULL },
   { "quit", 'q', 0, G_OPTION_ARG_NONE, &opt_quit, N_("Quit the running panel instance"), NULL },
-  { "version", 'v', 0, G_OPTION_ARG_NONE, &opt_version, N_("Print version information and exit"), NULL },
+  { "version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, N_("Print version information and exit"), NULL },
   { "sm-client-id", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_client_id, NULL, NULL },
   { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &opt_arguments, NULL, NULL },
   { NULL }
diff --git a/panel/panel-application.c b/panel/panel-application.c
index f4303e8..e5df4d6 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -429,7 +429,6 @@ panel_application_plugin_provider_signal (XfcePanelPluginProvider       *provide
         break;
 
       default:
-        g_critical ("Reveived unknown signal %d", signal);
         break;
     }
 }
diff --git a/panel/panel-item-dialog.c b/panel/panel-item-dialog.c
index c57914e..bc1a124 100644
--- a/panel/panel-item-dialog.c
+++ b/panel/panel-item-dialog.c
@@ -153,8 +153,11 @@ panel_item_dialog_init (PanelItemDialog *dialog)
   gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 450);
 
   /* add buttons */
-  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
-  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                          GTK_STOCK_HELP, GTK_RESPONSE_HELP,
+                          GTK_STOCK_ADD, GTK_RESPONSE_OK,
+                          GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+                          NULL);
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
 
   /* create main box */
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 8c2d5fa..5998954 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -32,6 +32,7 @@
 #include <panel/panel-application.h>
 #include <panel/panel-module.h>
 #include <panel/panel-itembar.h>
+#include <panel/panel-item-dialog.h>
 #include <panel/panel-preferences-dialog.h>
 #include <panel/panel-preferences-dialog-glade.h>
 
@@ -531,7 +532,7 @@ panel_preferences_dialog_item_move (GtkWidget              *button,
   provider = panel_preferences_dialog_item_get_selected (dialog, &iter_a);
 
   /* get the selection item */
-  if (G_LIKELY (provider))
+  if (G_LIKELY (provider != NULL))
     {
       /* get the itembar */
       itembar = gtk_bin_get_child (GTK_BIN (dialog->active));
@@ -591,19 +592,42 @@ panel_preferences_dialog_item_remove (GtkWidget              *button,
 {
   XfcePanelPluginProvider *provider;
   GtkTreeIter              iter;
+  GtkWidget               *widget, *toplevel;
+  PanelModule             *module;
 
   panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
 
   /* get the selected item in the treeview */
   provider = panel_preferences_dialog_item_get_selected (dialog, &iter);
+  if (G_LIKELY (provider != NULL))
+    {
+      /* get the panel module of the provider */
+      module = panel_module_get_from_plugin_provider (provider);
+
+      /* create question dialog (same code is also in xfce-panel-plugin.c) */
+      toplevel = gtk_widget_get_toplevel (button);
+      widget = gtk_message_dialog_new (GTK_WINDOW (toplevel), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
+                                       _("Are you sure that you want to remove \"%s\"?"), panel_module_get_name (module));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (widget), _("If you remove the item from the panel, it is permanently lost."));
+      gtk_dialog_add_buttons (GTK_DIALOG (widget), GTK_STOCK_CANCEL, GTK_RESPONSE_NO, GTK_STOCK_REMOVE, GTK_RESPONSE_YES, NULL);
+      gtk_dialog_set_default_response (GTK_DIALOG (widget), GTK_RESPONSE_NO);
+
+      /* run the dialog */
+      if (gtk_dialog_run (GTK_DIALOG (widget)) == GTK_RESPONSE_YES)
+        {
+          /* hide the dialog */
+          gtk_widget_hide (widget);
 
-  /* TODO, question dialog */
+          /* send signal */
+          xfce_panel_plugin_provider_emit_signal (provider, PROVIDER_SIGNAL_REMOVE_PLUGIN);
 
-  /* send signal */
-  xfce_panel_plugin_provider_emit_signal (provider, PROVIDER_SIGNAL_REMOVE_PLUGIN);
+          /* remove from treeview */
+          gtk_list_store_remove (dialog->store, &iter);
+        }
 
-  /* remove from treeview */
-  gtk_list_store_remove (dialog->store, &iter);
+      /* destroy */
+      gtk_widget_destroy (widget);
+    }
 }
 
 
@@ -614,7 +638,8 @@ panel_preferences_dialog_item_add (GtkWidget              *button,
 {
   panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
 
-  /* TODO */
+  /* show the items dialog */
+  panel_item_dialog_show (dialog->active);
 }
 
 
@@ -631,7 +656,8 @@ panel_preferences_dialog_item_properties (GtkWidget              *button,
   provider = panel_preferences_dialog_item_get_selected (dialog, NULL);
 
   /* emit configure-plugin signal */
-  xfce_panel_plugin_provider_show_configure (provider);
+  if (G_LIKELY (provider != NULL))
+    xfce_panel_plugin_provider_show_configure (provider);
 }
 
 
@@ -648,7 +674,8 @@ panel_preferences_dialog_item_about (GtkWidget              *button,
   provider = panel_preferences_dialog_item_get_selected (dialog, NULL);
 
   /* emit about signal */
-  xfce_panel_plugin_provider_show_about (provider);
+  if (G_LIKELY (provider != NULL))
+    xfce_panel_plugin_provider_show_about (provider);
 }
 
 
@@ -673,7 +700,7 @@ panel_preferences_dialog_item_selection_changed (GtkTreeSelection       *selecti
   /* get the selected item */
   provider = panel_preferences_dialog_item_get_selected (dialog, NULL);
 
-  if (provider)
+  if (G_LIKELY (provider != NULL))
     {
       /* get the itembar */
       itembar = gtk_bin_get_child (GTK_BIN (dialog->active));



More information about the Xfce4-commits mailing list