[Goodies-commits] r2724 - in xfce4-time-out-plugin/trunk: . panel-plugin

Jannis Pohlmann jannis at xfce.org
Sun May 6 22:12:04 CEST 2007


Author: jannis
Date: 2007-05-06 20:12:04 +0000 (Sun, 06 May 2007)
New Revision: 2724

Modified:
   xfce4-time-out-plugin/trunk/ChangeLog
   xfce4-time-out-plugin/trunk/configure.in.in
   xfce4-time-out-plugin/trunk/panel-plugin/time-out.c
Log:
	* configure.in.in: Check for --as-needed support for the 
	  linker.
	* panel-plugin/time-out.c: Only restart the break countdown
	  timer when the break countdown seconds have changed.  
 

Modified: xfce4-time-out-plugin/trunk/ChangeLog
===================================================================
--- xfce4-time-out-plugin/trunk/ChangeLog	2007-05-06 18:30:31 UTC (rev 2723)
+++ xfce4-time-out-plugin/trunk/ChangeLog	2007-05-06 20:12:04 UTC (rev 2724)
@@ -1,5 +1,12 @@
 2007-05-06	Jannis Pohlmann <jannis at xfce.org>
 
+	* configure.in.in: Check for --as-needed support for the 
+	  linker.
+	* panel-plugin/time-out.c: Only restart the break countdown
+	  timer when the break countdown seconds have changed. 
+
+2007-05-06	Jannis Pohlmann <jannis at xfce.org>
+
 	* configure.in.in: Post-release version bump.
 
 2007-05-06	Jannis Pohlmann <jannis at xfce.org>

Modified: xfce4-time-out-plugin/trunk/configure.in.in
===================================================================
--- xfce4-time-out-plugin/trunk/configure.in.in	2007-05-06 18:30:31 UTC (rev 2723)
+++ xfce4-time-out-plugin/trunk/configure.in.in	2007-05-06 20:12:04 UTC (rev 2724)
@@ -76,6 +76,30 @@
 dnl ***********************************
 XDT_FEATURE_DEBUG()
 
+dnl **************************************
+dnl *** Check for linker optimizations ***
+dnl **************************************
+AC_MSG_CHECKING([whether $LD accepts --as-needed])
+case `$LD --as-needed -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  LDFLAGS="$LDFLAGS -Wl,--as-needed"
+  AC_MSG_RESULT([yes])
+  ;;
+*)
+  AC_MSG_RESULT([no])
+  ;;
+esac
+AC_MSG_CHECKING([whether $LD accepts -O1])
+case `$LD -O1 -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  LDFLAGS="$LDFLAGS -Wl,-O1"
+  AC_MSG_RESULT([yes])
+  ;;
+*)
+  AC_MSG_RESULT([no])
+  ;;
+esac
+
 dnl *********************************
 dnl *** Substitute platform flags ***
 dnl *********************************

Modified: xfce4-time-out-plugin/trunk/panel-plugin/time-out.c
===================================================================
--- xfce4-time-out-plugin/trunk/panel-plugin/time-out.c	2007-05-06 18:30:31 UTC (rev 2723)
+++ xfce4-time-out-plugin/trunk/panel-plugin/time-out.c	2007-05-06 20:12:04 UTC (rev 2724)
@@ -97,8 +97,6 @@
 static void           time_out_end_configure                      (GtkDialog         *dialog,
                                                                    gint               response_id,
                                                                    TimeOutPlugin     *time_out);
-static void           time_out_break_countdown_seconds_changed    (GtkSpinButton     *spin_button,
-                                                                   TimeOutPlugin     *time_out);
 static void           time_out_lock_countdown_seconds_changed     (GtkSpinButton     *spin_button,
                                                                    TimeOutPlugin     *time_out);
 static void           time_out_postpone_countdown_seconds_changed (GtkSpinButton     *spin_button,
@@ -273,6 +271,10 @@
 
   /* Display the about menu item */
   xfce_panel_plugin_menu_show_about (plugin);
+
+  /* Start break countdown if the plugin is active */
+  if (G_LIKELY (time_out->enabled)) 
+    time_out_start_break_countdown (time_out, time_out->break_countdown_seconds);
 }
 
 
@@ -423,10 +425,12 @@
   /* Create break countdown time spin */
   spin = gtk_spin_button_new_with_range (1, 24 * 60, 1);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time_out->break_countdown_seconds / 60);
-  g_signal_connect (spin, "value-changed", G_CALLBACK (time_out_break_countdown_seconds_changed), time_out);
   gtk_table_attach_defaults (GTK_TABLE (table), spin, 1, 2, 0, 1);
   gtk_widget_show (spin);
 
+  /* Store reference on the spin button in the plugin */
+  g_object_set_data (G_OBJECT (time_out->plugin), "break-countdown-seconds-spin", spin);
+
   /* Create lock countdown time label */
   label = gtk_label_new (_("Break length (minutes):"));
   gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
@@ -509,18 +513,38 @@
                         gint           response_id,
                         TimeOutPlugin *time_out)
 {
+  GtkWidget *spin;
+  gint       value;
+  gboolean   restart = FALSE;
+
   /* Remove the dialog data from the plugin */
   g_object_set_data (G_OBJECT (time_out->plugin), "dialog", NULL);
 
   /* Unlock the panel menu */
   xfce_panel_plugin_unblock_menu (time_out->plugin);
 
+  /* Get spin button value for the break countdown settings */
+  spin = g_object_get_data (G_OBJECT (time_out->plugin), "break-countdown-seconds-spin");
+  value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)) * 60;
+  g_object_set_data (G_OBJECT (time_out->plugin), "break-countdown-seconds-spin", NULL);
+
+  /* Check if the break countdown seconds have changed */
+  restart = value != time_out->break_countdown_seconds;
+
+  /* Apply new break countdown seconds */
+  time_out->break_countdown_seconds = value;
+
   /* Save plugin configuration */
   time_out_save_settings (time_out);
 
-  /* Restart break countdown */
-  time_out_stop_break_countdown (time_out);
-  time_out_start_break_countdown (time_out, time_out->break_countdown_seconds);
+  /* Restart or resume break countdown */
+  if (G_UNLIKELY (restart))
+    {
+      time_out_stop_break_countdown (time_out);
+      time_out_start_break_countdown (time_out, time_out->break_countdown_seconds);
+    }
+  else
+    time_out_countdown_resume (time_out->break_countdown);
 
   /* Destroy the properties dialog */
   gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -529,19 +553,6 @@
 
 
 static void
-time_out_break_countdown_seconds_changed (GtkSpinButton *spin_button,
-                                          TimeOutPlugin *time_out)
-{
-  g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
-  g_return_if_fail (time_out != NULL);
-
-  /* Set plugin attribute */
-  time_out->break_countdown_seconds = gtk_spin_button_get_value_as_int (spin_button) * 60;
-}
-
-
-
-static void
 time_out_lock_countdown_seconds_changed (GtkSpinButton *spin_button,
                                          TimeOutPlugin *time_out)
 {




More information about the Goodies-commits mailing list