[Goodies-commits] r5568 - in xfce4-notes-plugin/trunk: . panel-plugin

Mike Massonnet mmassonnet at xfce.org
Sat Oct 11 17:27:52 CEST 2008


Author: mmassonnet
Date: 2008-10-11 15:27:51 +0000 (Sat, 11 Oct 2008)
New Revision: 5568

Modified:
   xfce4-notes-plugin/trunk/ChangeLog
   xfce4-notes-plugin/trunk/configure.in.in
   xfce4-notes-plugin/trunk/panel-plugin/defines.h
   xfce4-notes-plugin/trunk/panel-plugin/notes-properties-dialog.c
   xfce4-notes-plugin/trunk/panel-plugin/notes.c
   xfce4-notes-plugin/trunk/panel-plugin/notes.h
   xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c
Log:
Clean up \o/

Modified: xfce4-notes-plugin/trunk/ChangeLog
===================================================================
--- xfce4-notes-plugin/trunk/ChangeLog	2008-10-11 11:11:48 UTC (rev 5567)
+++ xfce4-notes-plugin/trunk/ChangeLog	2008-10-11 15:27:51 UTC (rev 5568)
@@ -1,3 +1,18 @@
+2008-05-11  Mike Massonnet <mmassonnet at xfce.org>
+
+Clean up \o/
+	* Use only one xfconf channel.
+	* By default hide notes windows from taskbar.
+	* Fix initial orientation of the panel to display the panel arrow in
+	the right direction.
+	* Don't close configuration dialog if the Help button is clicked.
+	* Load fallback icon GTK_STOCK_EDIT.
+	* Update configure.in.in file.
+
+2008-05-05  Mike Massonnet <mmassonnet at xfce.org>
+
+=== Release 1.6.2 ===
+
 2008-05-02  Mike Massonnet <mmassonnet at xfce.org>
 
 Fix compilation without xfconf

Modified: xfce4-notes-plugin/trunk/configure.in.in
===================================================================
--- xfce4-notes-plugin/trunk/configure.in.in	2008-10-11 11:11:48 UTC (rev 5567)
+++ xfce4-notes-plugin/trunk/configure.in.in	2008-10-11 15:27:51 UTC (rev 5568)
@@ -1,10 +1,9 @@
-dnl $Id$
 dnl
-dnl xfce4-notes-plugin - Notes applet for the Xfce4 panel
+dnl xfce4-notes-plugin - Notes plugin for the Xfce4 panel
 dnl
 dnl 2003 Benedikt Meurer <benedikt.meurer at unix-ag.uni-siegen.de>
 dnl 2003 Jakob Henriksson <b0kaj+dev at lysator.liu.se>
-dnl 2006, 2007 Mike Massonnet <mmassonnet at gmail.com>
+dnl 2006, 2008 Mike Massonnet <mmassonnet at gmail.com>
 dnl
 
 m4_define([xfce4_notes_plugin_version_major], [1])
@@ -16,7 +15,7 @@
 m4_define([xfce4_notes_plugin_version], [xfce4_notes_plugin_version_major().xfce4_notes_plugin_version_minor().xfce4_notes_plugin_version_micro()ifelse(xfce4_notes_plugin_version_nano(), [], [], [.xfce4_notes_plugin_version_nano()])ifelse(xfce4_notes_plugin_version_tag(), [svn], [xfce4_notes_plugin_version_tag()-xfce4_notes_plugin_version_build()], [xfce4_notes_plugin_version_tag()])])
 
 AC_INIT([xfce4-notes-plugin], [xfce4_notes_plugin_version], 
-        [mmassonnet at gmail.com])
+        [mmassonnet at xfce.org])
 
 AM_INIT_AUTOMAKE([xfce4-notes-plugin], [xfce4_notes_plugin_version()])
 AM_CONFIG_HEADER([config.h])
@@ -52,47 +51,35 @@
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.4.0])
 
 dnl check for xfconf
+enable_xfconf=yes
 m4_define([xfconf_minimum_version], [0])
-AC_ARG_ENABLE([configure-dialog],
-              [AC_HELP_STRING([--enable-configure-dialog],
-                              [Build with configure dialog (xfce >= 4.5)])],
-              [xfconf=$enableval],
-              [xfconf=no])
-if test "x$xfconf" = "xyes"; then
-    XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [xfconf_minimum_version], [have_xfconf=yes],
-                      [
-                      echo "*** Optional package libxfconf-0 was either not found on your system"
-                      echo "*** or is too old.  Please install or upgrade to at least version"
-                      echo "*** xfconf_minimum_version, or adjust the PKG_CONFIG_PATH environment variable"
-                      echo "*** if you installed the new version of the package in a nonstandard"
-                      echo "*** prefix.  Configuration dialog will be disabled."
-                      ])
+XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [xfconf_minimum_version],
+                  [AC_DEFINE([HAVE_XFCONF], [1], [Define if Xfconf is present])],
+                  [
+                  echo "*** Optional package libxfconf-0 was either not found on your system"
+                  echo "*** or is too old.  Please install or upgrade to at least version"
+                  echo "*** xfconf_minimum_version, or adjust the PKG_CONFIG_PATH environment variable"
+                  echo "*** if you installed the new version of the package in a nonstandard"
+                  echo "*** prefix."
+                  echo ""
+                  echo "*** Configuration dialog will be disabled!"
+                  enable_xfconf=no
+                  ])
 
-    if test "x$have_xfconf" = "xyes" ; then
-        AC_DEFINE([HAVE_XFCONF], [1], [Define if Xfconf is present])
-    fi
-fi
-
 dnl check for thunar_vfs
+enable_thunar_vfs=yes
 m4_define([thunar_minimum_version], [0.8.0])
-AC_ARG_ENABLE([fs-monitor],
-              [AC_HELP_STRING([--disable-fs-monitor],
-                              [Don't use thunar-vfs to monitor the file system. (default=enabled)])],
-              [thunar_vfs=$enableval],
-              [thunar_vfs=yes])
-if test "x$thunar_vfs" = "xyes" ; then
-    XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [thunar_minimum_version], [have_thunar_vfs=yes],
-                      [
-                      echo "*** Optional package thunar-vfs-1 was either not found on your system"
-                      echo "*** or is too old.  Please install or upgrade to at least version"
-                      echo "*** thunar_minimum_version, or adjust the PKG_CONFIG_PATH environment variable"
-                      echo "*** if you installed the new version of the package in a nonstandard"
-                      echo "*** prefix.  File system monitoring will be disabled."
-                      ])
-
-    if test "x$have_thunar_vfs" = "xyes" ; then
-        AC_DEFINE([HAVE_THUNAR_VFS], [1], [Define if thunar-vfs is present.])
-    fi
+XDT_CHECK_OPTIONAL_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [thunar_minimum_version],
+                           [fs-monitor], [Build with thunar-vfs support to monitor notes. (default=enabled)])
+if test "x$THUNAR_VFS_FOUND" != "xyes" ; then
+    echo "*** Optional package thunar-vfs-1 was either not found on your system"
+    echo "*** or is too old.  Please install or upgrade to at least version"
+    echo "*** thunar_minimum_version, or adjust the PKG_CONFIG_PATH environment variable"
+    echo "*** if you installed the new version of the package in a nonstandard"
+    echo "*** prefix."
+    echo ""
+    echo "*** File system monitoring will be disabled!"
+    enable_thunar_vfs=no
 fi
 
 dnl Translations
@@ -112,3 +99,15 @@
 panel-plugin/Makefile
 po/Makefile.in
 ])
+
+dnl ***************************
+dnl *** Print configuration ***
+dnl ***************************
+echo
+echo "Build Configuration:"
+echo
+echo "* Xfconf Support:         $enable_xfconf"
+echo "* Thunar-vfs Support:     $enable_thunar_vfs"
+echo "* Debug Support:          $enable_debug"
+echo
+

Modified: xfce4-notes-plugin/trunk/panel-plugin/defines.h
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/defines.h	2008-10-11 11:11:48 UTC (rev 5567)
+++ xfce4-notes-plugin/trunk/panel-plugin/defines.h	2008-10-11 15:27:51 UTC (rev 5568)
@@ -1,7 +1,6 @@
-/*  $Id$
+/*
+ *  Copyright (c) 2008 Mike Massonnet <mmassonnet at gmail.com>
  *
- *  Copyright (c) 2006 Mike Massonnet <mmassonnet at gmail.com>
- *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
@@ -20,10 +19,9 @@
 #ifndef DEFINES_H
 #define DEFINES_H
 
-#define BORDER      8
+#define BORDER                          8
+#define PLUGIN_WEBSITE                  "http://goodies.xfce.org/projects/panel-plugins/xfce4-notes-plugin"
+#define PLUGIN_XFCONF_CHANNEL           "xfce4-notes-plugin"
 
-#define XFCONF_CHANNEL_NEW_WINDOW       "xfce4-notes-plugin_new-window"
-#define XFCONF_CHANNEL_PANEL_PLUGIN     "xfce4-notes-plugin_panel-plugin"
-
 #endif
 

Modified: xfce4-notes-plugin/trunk/panel-plugin/notes-properties-dialog.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes-properties-dialog.c	2008-10-11 11:11:48 UTC (rev 5567)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes-properties-dialog.c	2008-10-11 15:27:51 UTC (rev 5568)
@@ -30,35 +30,34 @@
 
 
 
-static XfconfChannel *channel_panel_plugin = NULL;
-static XfconfChannel *channel_new_window = NULL;
+static XfconfChannel *xfconf_channel = NULL;
 
 static void
 cb_channel_panel_plugin_toggled (GtkToggleButton *button,
                                  const gchar *property)
 {
-  xfconf_channel_set_bool (channel_panel_plugin, property, gtk_toggle_button_get_active (button));
+  xfconf_channel_set_bool (xfconf_channel, property, gtk_toggle_button_get_active (button));
 }
 
 static void
 cb_channel_new_window_toggled (GtkToggleButton *button,
                                const gchar *property)
 {
-  xfconf_channel_set_bool (channel_new_window, property, gtk_toggle_button_get_active (button));
+  xfconf_channel_set_bool (xfconf_channel, property, gtk_toggle_button_get_active (button));
 }
 
 static void
 cb_channel_new_window_fontset (GtkFontButton *fontbutton,
                                const gchar *property)
 {
-  xfconf_channel_set_string (channel_new_window, property, gtk_font_button_get_font_name (fontbutton));
+  xfconf_channel_set_string (xfconf_channel, property, gtk_font_button_get_font_name (fontbutton));
 }
 
 static void
 cb_channel_new_window_scale (GtkRange *range,
                              const gchar *property)
 {
-  xfconf_channel_set_int (channel_new_window, property, (gint32)gtk_range_get_value (range));
+  xfconf_channel_set_int (xfconf_channel, property, (gint32)gtk_range_get_value (range));
 }
 
 GtkWidget *
@@ -68,11 +67,8 @@
   GtkWidget *fontbutton, *size_box;
 
   /* Configuration channel */
-  if (NULL == channel_panel_plugin && NULL == channel_new_window)
-    {
-      channel_panel_plugin = notes_plugin->channel_panel_plugin;
-      channel_new_window = notes_plugin->channel_new_window;
-    }
+  if (NULL == xfconf_channel)
+    xfconf_channel = notes_plugin->xfconf_channel;
 
   /* Dialog */
   dialog =
@@ -97,16 +93,16 @@
   /* Hide from taskbar */
   button = gtk_check_button_new_with_label (_("Hide windows from taskbar"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-                                xfconf_channel_get_bool (channel_panel_plugin, "/hide_windows_from_taskbar", FALSE));
+                                xfconf_channel_get_bool (xfconf_channel, "/general/hide_windows_from_taskbar", FALSE));
   gtk_container_add (GTK_CONTAINER (box), button);
-  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_panel_plugin_toggled), "/hide_windows_from_taskbar");
+  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_panel_plugin_toggled), "/general/hide_windows_from_taskbar");
 
   /* Hide arrow button */
   button = gtk_check_button_new_with_label (_("Hide arrow button"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-                                xfconf_channel_get_bool (channel_panel_plugin, "/hide_arrow_button", FALSE));
+                                xfconf_channel_get_bool (xfconf_channel, "/general/hide_arrow_button", FALSE));
   gtk_container_add (GTK_CONTAINER (box), button);
-  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_panel_plugin_toggled), "/hide_arrow_button");
+  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_panel_plugin_toggled), "/general/hide_arrow_button");
 
   /* === New window settings === */
   box = gtk_vbox_new (TRUE, BORDER);
@@ -117,23 +113,23 @@
   /* Always on top */
   button = gtk_check_button_new_with_label (_("Always on top"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-                                xfconf_channel_get_bool (channel_new_window, "/window_state/always_on_top", FALSE));
+                                xfconf_channel_get_bool (xfconf_channel, "/new_window/always_on_top", FALSE));
   gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0);
-  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/window_state/always_on_top");
+  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/new_window/always_on_top");
 
   /* Sticky window */
   button = gtk_check_button_new_with_label (_("Sticky window"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-                                xfconf_channel_get_bool (channel_new_window, "/window_state/sticky", TRUE));
+                                xfconf_channel_get_bool (xfconf_channel, "/new_window/sticky", TRUE));
   gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0);
-  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/window_state/sticky");
+  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/new_window/sticky");
 
   /* Resize grip */
   button = gtk_check_button_new_with_label (_("Resize grip"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-                                xfconf_channel_get_bool (channel_new_window, "/window_state/resize_grip", FALSE));
+                                xfconf_channel_get_bool (xfconf_channel, "/new_window/resize_grip", FALSE));
   gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0);
-  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/window_state/resize_grip");
+  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/new_window/resize_grip");
 
   /* Font */
   hbox = gtk_hbox_new (FALSE, BORDER);
@@ -141,15 +137,15 @@
 
   button = gtk_check_button_new_with_label (_("Font"));
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
-                                xfconf_channel_get_bool (channel_new_window, "/window_state/use_font", FALSE));
+                                xfconf_channel_get_bool (xfconf_channel, "/new_window/use_font", FALSE));
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/window_state/use_font");
+  g_signal_connect (button, "toggled", G_CALLBACK (cb_channel_new_window_toggled), "/new_window/use_font");
 
-  gchar *description = xfconf_channel_get_string (channel_new_window, "/font/description", "Sans 10");
+  gchar *description = xfconf_channel_get_string (xfconf_channel, "/new_window/font_description", "Sans 10");
   fontbutton = gtk_font_button_new_with_font (description);
   g_free (description);
   gtk_box_pack_start (GTK_BOX (hbox), fontbutton, TRUE, TRUE, 0);
-  g_signal_connect (fontbutton, "font-set", G_CALLBACK (cb_channel_new_window_fontset), "/font/description");
+  g_signal_connect (fontbutton, "font-set", G_CALLBACK (cb_channel_new_window_fontset), "/new_window/font_description");
 
   /* Size */
   hbox = gtk_hbox_new (FALSE, BORDER);
@@ -163,20 +159,20 @@
 
   scale = gtk_hscale_new_with_range (20, 600, 10);
   gtk_range_set_value (GTK_RANGE (scale),
-                       (gdouble)xfconf_channel_get_int (channel_new_window, "/geometry/width", 375));
+                       (gdouble)xfconf_channel_get_int (xfconf_channel, "/new_window/width", 375));
   gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_RIGHT);
   gtk_box_pack_start (GTK_BOX (size_box), scale, TRUE, TRUE, 0);
-  g_signal_connect (scale, "value-changed", G_CALLBACK (cb_channel_new_window_scale), "/geometry/width");
+  g_signal_connect (scale, "value-changed", G_CALLBACK (cb_channel_new_window_scale), "/new_window/width");
 
   label = gtk_label_new ("×");
   gtk_box_pack_start (GTK_BOX (size_box), label, FALSE, FALSE, 0);
 
   scale = gtk_hscale_new_with_range (20, 600, 10);
   gtk_range_set_value (GTK_RANGE (scale),
-                       (gdouble)xfconf_channel_get_int (channel_new_window, "/geometry/height", 430));
+                       (gdouble)xfconf_channel_get_int (xfconf_channel, "/new_window/height", 430));
   gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_LEFT);
   gtk_box_pack_start (GTK_BOX (size_box), scale, TRUE, TRUE, 0);
-  g_signal_connect (scale, "value-changed", G_CALLBACK (cb_channel_new_window_scale), "/geometry/height");
+  g_signal_connect (scale, "value-changed", G_CALLBACK (cb_channel_new_window_scale), "/new_window/height");
 
   /* === Ending === */
   gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);

Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.c	2008-10-11 11:11:48 UTC (rev 5567)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.c	2008-10-11 15:27:51 UTC (rev 5568)
@@ -174,15 +174,16 @@
   gtk_window_set_title (GTK_WINDOW (notes_window->window), window_name);
 #ifdef HAVE_XFCONF
   gtk_window_set_skip_taskbar_hint (GTK_WINDOW (notes_window->window),
-                                    xfconf_channel_get_bool (notes_plugin->channel_panel_plugin,
-                                                             "/hide_windows_from_taskbar",
-                                                             FALSE));
+                                    xfconf_channel_get_bool (notes_plugin->xfconf_channel,
+                                                             "/general/hide_windows_from_taskbar", TRUE));
   gtk_window_set_default_size (GTK_WINDOW (notes_window->window),
-                               xfconf_channel_get_int (notes_plugin->channel_new_window, "/window_geometry/width", 375),
-                               xfconf_channel_get_int (notes_plugin->channel_new_window, "/window_geometry/height", 430));
+                               xfconf_channel_get_int (notes_plugin->xfconf_channel,
+                                                       "/new_window/width", 375),
+                               xfconf_channel_get_int (notes_plugin->xfconf_channel,
+                                                       "/new_window/height", 430));
 #else
-  gtk_window_set_default_size (GTK_WINDOW (notes_window->window),
-                               375, 430);
+  gtk_window_set_skip_taskbar_hint (GTK_WINDOW (notes_window->window), TRUE);
+  gtk_window_set_default_size (GTK_WINDOW (notes_window->window), 375, 430);
 #endif
   gtk_window_set_decorated (GTK_WINDOW (notes_window->window), FALSE);
   gtk_window_set_icon_name (GTK_WINDOW (notes_window->window), "xfce4-notes-plugin");
@@ -525,16 +526,16 @@
     }
 
 #ifdef HAVE_XFCONF
-  w =               xfconf_channel_get_int  (notes_plugin->channel_new_window, "/window_geometry/width", w);
-  h =               xfconf_channel_get_int  (notes_plugin->channel_new_window, "/window_geometry/height", h);
-  above =           xfconf_channel_get_bool (notes_plugin->channel_new_window, "/window_state/always_on_top", above);
-  show_on_startup = xfconf_channel_get_bool (notes_plugin->channel_new_window, "/window_state/show_on_startup", show_on_startup);
-  show_statusbar =  xfconf_channel_get_bool (notes_plugin->channel_new_window, "/window_state/resize_grip", show_statusbar);
-  sticky =          xfconf_channel_get_bool (notes_plugin->channel_new_window, "/window_state/sticky", sticky);
-  visible =         xfconf_channel_get_bool (notes_plugin->channel_new_window, "/window_state/visible", visible);
-  transparency =    xfconf_channel_get_int  (notes_plugin->channel_new_window, "/window_state/transparency", transparency);
-  if (xfconf_channel_get_bool (notes_plugin->channel_new_window, "/window_state/use_font", FALSE))
-    font_descr =    xfconf_channel_get_string (notes_plugin->channel_new_window, "/window_font/description", "Sans 10");
+  w =               xfconf_channel_get_int  (notes_plugin->xfconf_channel, "/new_window/width", w);
+  h =               xfconf_channel_get_int  (notes_plugin->xfconf_channel, "/new_window/height", h);
+  above =           xfconf_channel_get_bool (notes_plugin->xfconf_channel, "/new_window/always_on_top", above);
+  show_on_startup = xfconf_channel_get_bool (notes_plugin->xfconf_channel, "/new_window/show_on_startup", show_on_startup);
+  show_statusbar =  xfconf_channel_get_bool (notes_plugin->xfconf_channel, "/new_window/show_resize_grip", show_statusbar);
+  sticky =          xfconf_channel_get_bool (notes_plugin->xfconf_channel, "/new_window/sticky", sticky);
+  visible =         xfconf_channel_get_bool (notes_plugin->xfconf_channel, "/new_window/visible", visible);
+  transparency =    xfconf_channel_get_int  (notes_plugin->xfconf_channel, "/new_window/transparency", transparency);
+  if (xfconf_channel_get_bool (notes_plugin->xfconf_channel, "/new_window/use_font", FALSE))
+    font_descr =    xfconf_channel_get_string (notes_plugin->xfconf_channel, "/new_window/font_description", "Sans 10");
 #endif
 
   rc = xfce_rc_simple_open (notes_window->notes_plugin->config_file, FALSE);

Modified: xfce4-notes-plugin/trunk/panel-plugin/notes.h
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/notes.h	2008-10-11 11:11:48 UTC (rev 5567)
+++ xfce4-notes-plugin/trunk/panel-plugin/notes.h	2008-10-11 15:27:51 UTC (rev 5568)
@@ -61,9 +61,9 @@
   GtkTooltips          *tooltips;
 
 #ifdef HAVE_XFCONF
-  XfconfChannel        *channel_panel_plugin;
-  XfconfChannel        *channel_new_window;
+  XfconfChannel        *xfconf_channel;
 #endif
+
 #ifdef HAVE_THUNAR_VFS
   ThunarVfsMonitor     *monitor;
   ThunarVfsPath        *thunar_vfs_path;

Modified: xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c
===================================================================
--- xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c	2008-10-11 11:11:48 UTC (rev 5567)
+++ xfce4-notes-plugin/trunk/panel-plugin/panel-plugin.c	2008-10-11 15:27:51 UTC (rev 5568)
@@ -30,8 +30,6 @@
 #endif
 #include "xfce4-popup-notes.h"
 
-#define PLUGIN_NAME "xfce4-notes-plugin"
-#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-notes-plugin"
 
 
 
@@ -102,24 +100,32 @@
 static void
 notes_plugin_register (XfcePanelPlugin *panel_plugin)
 {
+  NotesPlugin *notes_plugin;
+  GtkOrientation orientation;
+
   DBG ("\nProperties: size = %d, screen_position = %d",
        xfce_panel_plugin_get_size (panel_plugin),
        xfce_panel_plugin_get_screen_position (panel_plugin));
 
   xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
 
-  NotesPlugin *notes_plugin = notes_plugin_new (panel_plugin);
-  g_return_if_fail (G_LIKELY (notes_plugin != NULL));
+  notes_plugin = notes_plugin_new (panel_plugin);
+
+  /* Set initial orientation for the arrow */
+  orientation = xfce_panel_plugin_get_orientation (panel_plugin);
+  notes_plugin_set_orientation (notes_plugin, orientation);
+
 #ifdef HAVE_XFCONF
   notes_plugin_monitor_xfconf (notes_plugin);
 #endif
 
   gtk_widget_show_all (GTK_WIDGET (panel_plugin));
 #ifdef HAVE_XFCONF
-  if (xfconf_channel_get_bool (notes_plugin->channel_panel_plugin, "/hide_arrow_button", FALSE))
+  if (xfconf_channel_get_bool (notes_plugin->xfconf_channel, "/general/hide_arrow_button", FALSE))
     gtk_widget_hide (notes_plugin->btn_arrow);
 #endif
 
+  /* TODO Postpone this call inside a idle function */
   notes_plugin_load_data (notes_plugin);
 }
 
@@ -223,22 +229,26 @@
 static void
 notes_plugin_configure (NotesPlugin *notes_plugin)
 {
-  GtkWidget *dialog = prop_dialog_new (notes_plugin);
-  g_return_if_fail (G_LIKELY (GTK_IS_WIDGET (dialog)));
+  GtkWidget *dialog;
+  gint result;
 
   xfce_panel_plugin_block_menu (notes_plugin->panel_plugin);
+  dialog = prop_dialog_new (notes_plugin);
 
-  gint result = gtk_dialog_run (GTK_DIALOG (dialog));
-  if (result == GTK_RESPONSE_HELP)
+  while (1)
     {
-      result = g_spawn_command_line_async ("exo-open " PLUGIN_WEBSITE, NULL);
-      if (G_UNLIKELY (result == FALSE))
-        g_warning (_("Unable to open the following url: %s"), PLUGIN_WEBSITE);
+      result = gtk_dialog_run (GTK_DIALOG (dialog));
+      if (result == GTK_RESPONSE_HELP)
+        {
+          result = g_spawn_command_line_async ("exo-open " PLUGIN_WEBSITE, NULL);
+          if (G_UNLIKELY (result == FALSE))
+            g_warning (_("Unable to open the following url: %s"), PLUGIN_WEBSITE);
+        }
+      else
+        break;
     }
 
-  if (GTK_IS_WIDGET (dialog))
-    gtk_widget_destroy (dialog);
-
+  gtk_widget_destroy (dialog);
   xfce_panel_plugin_unblock_menu (notes_plugin->panel_plugin);
 }
 #endif
@@ -252,7 +262,10 @@
   gtk_widget_set_size_request (notes_plugin->btn_panel, size, size);
   size -= 2 + 2 * MAX (notes_plugin->btn_panel->style->xthickness,
                        notes_plugin->btn_panel->style->ythickness);
+
   GdkPixbuf *pixbuf = xfce_themed_icon_load ("xfce4-notes-plugin", size);
+  if (G_LIKELY (NULL == pixbuf))
+    pixbuf = xfce_themed_icon_load (GTK_STOCK_EDIT, size);
   gtk_image_set_from_pixbuf (GTK_IMAGE (notes_plugin->icon_panel), pixbuf);
   g_object_unref (G_OBJECT (pixbuf));
 
@@ -264,15 +277,35 @@
                               GtkOrientation orientation)
 {
   xfce_hvbox_set_orientation (notes_plugin->box_panel, orientation);
+
   XfceScreenPosition position = xfce_panel_plugin_get_screen_position (notes_plugin->panel_plugin);
-  if (xfce_screen_position_is_top (position))
-    xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_DOWN);
-  else if (xfce_screen_position_is_left (position))
-    xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_RIGHT);
-  else if (xfce_screen_position_is_right (position))
-    xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_LEFT);
-  else /*if (xfce_screen_position_is_bottom (position))*/
-    xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_UP);
+
+  switch (position)
+    {
+    default:
+    case XFCE_SCREEN_POSITION_FLOATING_H:
+    case XFCE_SCREEN_POSITION_NW_H:
+    case XFCE_SCREEN_POSITION_N:
+    case XFCE_SCREEN_POSITION_NE_H:
+      xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_DOWN);
+      break;
+    case XFCE_SCREEN_POSITION_FLOATING_V:
+    case XFCE_SCREEN_POSITION_NW_V:
+    case XFCE_SCREEN_POSITION_W:
+    case XFCE_SCREEN_POSITION_SW_V:
+      xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_RIGHT);
+      break;
+    case XFCE_SCREEN_POSITION_NE_V:
+    case XFCE_SCREEN_POSITION_E:
+    case XFCE_SCREEN_POSITION_SE_V:
+      xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_LEFT);
+      break;
+    case XFCE_SCREEN_POSITION_SW_H:
+    case XFCE_SCREEN_POSITION_S:
+    case XFCE_SCREEN_POSITION_SE_H:
+      xfce_arrow_button_set_arrow_type (notes_plugin->btn_arrow, GTK_ARROW_UP);
+      break;
+    }
 }
 
 static void
@@ -317,9 +350,11 @@
 notes_plugin_free (NotesPlugin *notes_plugin)
 {
   notes_plugin_save_data_all (notes_plugin);
+
 #ifdef HAVE_XFCONF
   xfconf_shutdown ();
 #endif
+
 #ifdef HAVE_THUNAR_VFS
   /* TODO move code out from notes_window_destroy and add notes_window_free
    * which would only free memory and not corrupt notes or configuration data
@@ -349,9 +384,8 @@
 static void
 notes_plugin_monitor_xfconf (NotesPlugin *notes_plugin)
 {
-  notes_plugin->channel_new_window = xfconf_channel_new (XFCONF_CHANNEL_NEW_WINDOW);
-  notes_plugin->channel_panel_plugin = xfconf_channel_new (XFCONF_CHANNEL_PANEL_PLUGIN);
-  g_signal_connect_swapped (notes_plugin->channel_panel_plugin, "property-changed",
+  notes_plugin->xfconf_channel = xfconf_channel_new (PLUGIN_XFCONF_CHANNEL);
+  g_signal_connect_swapped (notes_plugin->xfconf_channel, "property-changed",
                             G_CALLBACK (notes_plugin_xfconf_property_changed), notes_plugin);
 }
 
@@ -362,19 +396,18 @@
 {
   /* Refresh both elements
    * TODO find out how to guess efficiently the property name */
-  gboolean v = g_value_get_boolean (value);
-  if (!g_ascii_strcasecmp (property, "/hide_windows_from_taskbar"))
+  if (!g_ascii_strcasecmp (property, "/general/hide_windows_from_taskbar"))
     {
       GSList *l;
       for (l = notes_plugin->windows; l != NULL; l = l->next)
         {
           NotesWindow *notes_window = l->data;
-          gtk_window_set_skip_taskbar_hint (GTK_WINDOW (notes_window->window), v);
+          gtk_window_set_skip_taskbar_hint (GTK_WINDOW (notes_window->window), g_value_get_boolean (value));
         }
     }
-  else if (!g_ascii_strcasecmp (property, "/hide_arrow_button"))
+  else if (!g_ascii_strcasecmp (property, "/general/hide_arrow_button"))
     {
-      if (v)
+      if (g_value_get_boolean (value))
         gtk_widget_hide (notes_plugin->btn_arrow);
       else
         gtk_widget_show (notes_plugin->btn_arrow);




More information about the Goodies-commits mailing list