[gnome-screenshot] application: factor out a screenshot_show_interactive_dialog() function
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screenshot] application: factor out a screenshot_show_interactive_dialog() function
- Date: Wed, 23 Jan 2013 15:43:27 +0000 (UTC)
commit 0a657f2e62154e76974712b1007dde0e25745004
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jan 23 10:40:42 2013 -0500
application: factor out a screenshot_show_interactive_dialog() function
This will be used in a later commit.
https://bugzilla.gnome.org/show_bug.cgi?id=692386
src/screenshot-application.c | 47 ++++++++++++++++++++++-------------------
1 files changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index 1c5545b..c3295d5 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -46,6 +46,7 @@
G_DEFINE_TYPE (ScreenshotApplication, screenshot_application, GTK_TYPE_APPLICATION);
static void screenshot_save_to_file (ScreenshotApplication *self);
+static void screenshot_show_interactive_dialog (ScreenshotApplication *self);
struct _ScreenshotApplicationPriv {
gchar *icc_profile_base64;
@@ -644,6 +645,16 @@ interactive_dialog_response_cb (GtkWidget *d,
}
static void
+screenshot_show_interactive_dialog (ScreenshotApplication *self)
+{
+ GtkWidget *dialog;
+
+ dialog = screenshot_interactive_dialog_new ();
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (interactive_dialog_response_cb), self);
+}
+
+static void
action_quit (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -696,38 +707,30 @@ static void
screenshot_application_startup (GApplication *app)
{
ScreenshotApplication *self = SCREENSHOT_APPLICATION (app);
+ GtkBuilder *builder;
+ GMenuModel *menu;
G_APPLICATION_CLASS (screenshot_application_parent_class)->startup (app);
gtk_window_set_default_icon_name (SCREENSHOOTER_ICON);
screenshooter_init_stock_icons ();
- /* interactive mode: trigger the dialog and wait for the response */
- if (screenshot_config->interactive)
- {
- GtkWidget *dialog;
- GtkBuilder *builder;
- GMenuModel *menu;
+ g_action_map_add_action_entries (G_ACTION_MAP (self), action_entries,
+ G_N_ELEMENTS (action_entries), self);
- g_action_map_add_action_entries (G_ACTION_MAP (self), action_entries,
- G_N_ELEMENTS (action_entries), self);
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (builder, "/org/gnome/screenshot/screenshot-app-menu.ui", NULL);
+ menu = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
+ gtk_application_set_app_menu (GTK_APPLICATION (self), menu);
- builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/org/gnome/screenshot/screenshot-app-menu.ui", NULL);
- menu = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
- gtk_application_set_app_menu (GTK_APPLICATION (self), menu);
+ g_object_unref (builder);
+ g_object_unref (menu);
- g_object_unref (builder);
- g_object_unref (menu);
-
- dialog = screenshot_interactive_dialog_new ();
- g_signal_connect (dialog, "response",
- G_CALLBACK (interactive_dialog_response_cb), self);
- }
+ /* interactive mode: trigger the dialog and wait for the response */
+ if (screenshot_config->interactive)
+ screenshot_show_interactive_dialog (self);
else
- {
- screenshot_start (self);
- }
+ screenshot_start (self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]