[Xfce4-commits] <orage:master> 4.9.7.0 enhancement 10432 option to set Orage to quit when it is asked to close

Juha Kautto noreply at xfce.org
Thu Nov 7 09:18:01 CET 2013


Updating branch refs/heads/master
         to fbdeb827dea0eeac0147cc25811623bcd4571450 (commit)
       from a54bd7ab56e5174d45f21421845b897e11605503 (commit)

commit fbdeb827dea0eeac0147cc25811623bcd4571450
Author: Juha Kautto <juha at xfce.org>
Date:   Thu Nov 7 10:15:22 2013 +0200

    4.9.7.0 enhancement 10432 option to set Orage to quit when it is asked to close
    
    Added parameter to extra screen to quit Orage instead of hide. This is usefull
    when Orage is used in distributed environments in many machines.

 configure.in.in           |    2 +-
 src/main.c                |   30 ++++++++++++++++++------------
 src/mainbox.c             |    6 ++++--
 src/parameters.c          |   33 ++++++++++++++++++++++++++++++++-
 src/parameters.h          |    4 ++++
 src/parameters_internal.h |    3 +++
 6 files changed, 62 insertions(+), 16 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 2c160cf..77e10f2 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -9,7 +9,7 @@ dnl Written for Xfce by Juha Kautto <juha at xfce.org>
 dnl
 
 dnl Version information
-m4_define([orage_version], [4.9.6.3-git])
+m4_define([orage_version], [4.9.7.0-git])
 
 m4_define([gtk_minimum_version], [2.14.0])
 m4_define([xfce_minimum_version], [4.8.0])
diff --git a/src/main.c b/src/main.c
index 1c17d5a..089069b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -169,10 +169,27 @@ static void raise_orage(void)
     send_event("_XFCE_CALENDAR_RAISE");
 }
 
+static gboolean keep_tidy(void)
+{
+#ifdef HAVE_ARCHIVE
+    /* move old appointment to other file to keep the active
+       calendar file smaller and faster */
+    xfical_archive();
+#endif
+    
+    write_parameters();
+    return(TRUE);
+}
+
 static gboolean mWindow_delete_event_cb(GtkWidget *widget, GdkEvent *event
         , gpointer user_data)
 {
-    orage_toggle_visible();
+    if (g_par.close_means_quit) {
+        gtk_main_quit();
+    }
+    else {
+        orage_toggle_visible();
+    }
     return(TRUE);
 }
 
@@ -227,17 +244,6 @@ static gboolean client_message_received(GtkWidget *widget
     return(FALSE);
 }
 
-static gboolean keep_tidy(void)
-{
-#ifdef HAVE_ARCHIVE
-    /* move old appointment to other file to keep the active
-       calendar file smaller and faster */
-    xfical_archive();
-#endif
-    write_parameters();
-    return(TRUE);
-}
-
 /*
  * SaveYourself callback
  *
diff --git a/src/mainbox.c b/src/mainbox.c
index c63ec68..e232dd2 100644
--- a/src/mainbox.c
+++ b/src/mainbox.c
@@ -107,7 +107,10 @@ static void mFile_close_activate_cb(GtkMenuItem *menuitem, gpointer user_data)
 #ifdef ORAGE_DEBUG
     orage_message(-100, P_N);
 #endif
-    gtk_widget_hide(cal->mWindow);
+    if (g_par.close_means_quit)
+        gtk_main_quit();
+    else
+        gtk_widget_hide(cal->mWindow);
 }
 
 static void mFile_quit_activate_cb(GtkMenuItem *menuitem, gpointer user_data)
@@ -875,7 +878,6 @@ void build_mainWin(void)
     g_signal_connect((gpointer) cal->mCalendar, "day_selected"
             , G_CALLBACK(mCalendar_day_selected_cb)
             , (gpointer) cal);
-
     g_signal_connect((gpointer) cal->mCalendar, "month-changed"
             , G_CALLBACK(mCalendar_month_changed_cb), (gpointer) cal);
 
diff --git a/src/parameters.c b/src/parameters.c
index 6c30ffd..18a3a97 100644
--- a/src/parameters.c
+++ b/src/parameters.c
@@ -447,13 +447,20 @@ static void set_wakeup_timer()
 static void use_wakeup_timer_changed(GtkWidget *dialog, gpointer user_data)
 {
     Itf *itf = (Itf *)user_data;
-    GdkPixbuf *orage_logo;
 
     g_par.use_wakeup_timer = gtk_toggle_button_get_active(
             GTK_TOGGLE_BUTTON(itf->use_wakeup_timer_checkbutton));
     set_wakeup_timer();
 }
 
+static void always_quit_changed(GtkWidget *dialog, gpointer user_data)
+{
+    Itf *itf = (Itf *)user_data;
+
+    g_par.close_means_quit = gtk_toggle_button_get_active(
+            GTK_TOGGLE_BUTTON(itf->always_quit_checkbutton));
+}
+
 static void create_parameter_dialog_main_setup_tab(Itf *dialog)
 {
     GtkWidget *hbox, *vbox, *label;
@@ -853,6 +860,7 @@ static void create_parameter_dialog_extra_setup_tab(Itf *dialog)
     gtk_widget_set_tooltip_text(dialog->el_extra_days_spin
             , _("This is just the default value, you can change it in the actual eventlist window."));
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
     g_signal_connect(G_OBJECT(dialog->el_extra_days_spin), "value-changed"
             , G_CALLBACK(el_extra_days_spin_changed), dialog);
 
@@ -908,6 +916,7 @@ static void create_parameter_dialog_extra_setup_tab(Itf *dialog)
             dialog->use_dynamic_icon_checkbutton), g_par.use_dynamic_icon);
     gtk_widget_set_tooltip_text(dialog->use_dynamic_icon_checkbutton
             , _("Dynamic icon shows current month and day of the month."));
+
     g_signal_connect(G_OBJECT(dialog->use_dynamic_icon_checkbutton), "toggled"
             , G_CALLBACK(use_dynamic_icon_changed), dialog);
 
@@ -926,6 +935,7 @@ static void create_parameter_dialog_extra_setup_tab(Itf *dialog)
             dialog->use_wakeup_timer_checkbutton), g_par.use_wakeup_timer);
     gtk_widget_set_tooltip_text(dialog->use_wakeup_timer_checkbutton
             , _("Use this timer if Orage has problems waking up properly after suspend or hibernate. (For example tray icon not refreshed or alarms not firing.)"));
+
     g_signal_connect(G_OBJECT(dialog->use_wakeup_timer_checkbutton), "toggled"
             , G_CALLBACK(use_wakeup_timer_changed), dialog);
 
@@ -965,6 +975,25 @@ static void create_parameter_dialog_extra_setup_tab(Itf *dialog)
 
     g_signal_connect(G_OBJECT(dialog->foreign_alarm_notification_radiobutton)
             , "toggled", G_CALLBACK(foreign_alarm_changed), dialog);
+
+    /***** always quit *****/
+    hbox = gtk_vbox_new(FALSE, 0);
+    dialog->always_quit_frame = orage_create_framebox_with_content(
+            _("always quit when asked to close"), hbox);
+    gtk_box_pack_start(GTK_BOX(dialog->extra_vbox)
+            , dialog->always_quit_frame, FALSE, FALSE, 5);
+
+    dialog->always_quit_checkbutton = 
+            gtk_check_button_new_with_mnemonic(_("Always quit"));
+    gtk_box_pack_start(GTK_BOX(hbox)
+            , dialog->always_quit_checkbutton, FALSE, FALSE, 5);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
+            dialog->always_quit_checkbutton), g_par.close_means_quit);
+    gtk_widget_set_tooltip_text(dialog->always_quit_checkbutton
+            , _("By default Orage stays open in the background when asked to close. This option changes Orage to quit and never stay in background when it is asked to close."));
+
+    g_signal_connect(G_OBJECT(dialog->always_quit_checkbutton), "toggled"
+            , G_CALLBACK(always_quit_changed), dialog);
 }
 
 static Itf *create_parameter_dialog(void)
@@ -1214,6 +1243,7 @@ void read_parameters(void)
     g_log_level = orage_rc_get_int(orc, "Logging level", 0);
     g_par.priority_list_limit = orage_rc_get_int(orc, "Priority list limit", 8);
     g_par.use_wakeup_timer = orage_rc_get_bool(orc, "Use wakeup timer", TRUE);
+    g_par.close_means_quit = orage_rc_get_bool(orc, "Always quit", FALSE);
 
     orage_rc_file_close(orc);
 }
@@ -1315,6 +1345,7 @@ void write_parameters(void)
     orage_rc_put_int(orc, "Logging level", g_log_level);
     orage_rc_put_int(orc, "Priority list limit", g_par.priority_list_limit);
     orage_rc_put_bool(orc, "Use wakeup timer", g_par.use_wakeup_timer);
+    orage_rc_put_bool(orc, "Always quit", g_par.close_means_quit);
 
     orage_rc_file_close(orc);
 }
diff --git a/src/parameters.h b/src/parameters.h
index a4651f9..443dd09 100644
--- a/src/parameters.h
+++ b/src/parameters.h
@@ -24,6 +24,7 @@
 #define __ORAGE_PARAMETERS_H__
 
 #define ORAGE_WAKEUP_TIMER_PERIOD 60
+
 typedef struct _foreign_file
 {
     char *file;
@@ -125,6 +126,9 @@ typedef struct _parameters
     /* some systems are not able to wake up properly from suspend/hibernate
        and we need to monitor the status ourselves */
     gboolean use_wakeup_timer;
+
+    /* always quit instead of going to background when asked to close */
+    gboolean close_means_quit;
 } global_parameters; /* global parameters */
 
 #ifdef ORAGE_MAIN
diff --git a/src/parameters_internal.h b/src/parameters_internal.h
index b09614f..86e5a34 100644
--- a/src/parameters_internal.h
+++ b/src/parameters_internal.h
@@ -109,6 +109,9 @@ typedef struct _Itf
     GSList    *foreign_alarm_radiobutton_group;
     GtkWidget *foreign_alarm_orage_radiobutton;
     GtkWidget *foreign_alarm_notification_radiobutton;
+    /* always quit (also when asked to close) */
+    GtkWidget *always_quit_frame;
+    GtkWidget *always_quit_checkbutton;
 
     /***** the rest in all tabs *****/
     GtkWidget *close_button;


More information about the Xfce4-commits mailing list