From: phantomjinx <pha...@us...> - 2011-11-05 15:00:42
|
commit f671cc889de10b198d98d5f4d54cbebe237de4bb Author: phantomjinx <p.g...@ph...> Date: Sat Nov 5 14:32:55 2011 +0000 Updates to anjuta app and implement preference for splash screen * Updates anjuta-app.c to equivalent of the version in the HEAD of anjuta repository. * Implements a preference for disabling the splash screen. data/glade/core-gtkpod.xml | 245 ++++++++++++++++++++++++++++++++------------ libgtkpod/gp_itdb.c | 1 - libgtkpod/prefs.h | 2 + src/anjuta-app.c | 42 ++++++-- src/gtkpod.c | 21 +++-- 5 files changed, 227 insertions(+), 84 deletions(-) --- diff --git a/data/glade/core-gtkpod.xml b/data/glade/core-gtkpod.xml index 5c1fa24..8ed1a0c 100644 --- a/data/glade/core-gtkpod.xml +++ b/data/glade/core-gtkpod.xml @@ -1,24 +1,109 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.16"/> - <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkWindow" id="anjuta_preferences_window"> + <property name="can_focus">False</property> + <child> + <object class="GtkNotebook" id="General"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <object class="GtkVBox" id="general_page"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkFrame" id="Session"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">10</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">18</property> + <child> + <object class="GtkVBox" id="vbox2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">10</property> + <property name="spacing">5</property> + <child> + <object class="GtkCheckButton" id="preferences_disable_splash_screen"> + <property name="label" translatable="yes">Turn off the splash screen</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_disable_splash_screen_toggled" swapped="no"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Session</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + <child type="tab"> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">General</property> + </object> + <packing> + <property name="tab_fill">False</property> + </packing> + </child> + </object> + </child> + </object> <object class="GtkDialog" id="confirm_dialog"> + <property name="can_focus">False</property> <property name="border_width">6</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox1"> + <object class="GtkBox" id="dialog-vbox1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">1</property> <child> <object class="GtkHBox" id="hbox169"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="border_width">6</property> <property name="spacing">12</property> <child> <object class="GtkImage" id="image18"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="yalign">0</property> <property name="stock">gtk-dialog-warning</property> @@ -33,7 +118,7 @@ <child> <object class="GtkVBox" id="vbox6"> <property name="visible">True</property> - <property name="orientation">vertical</property> + <property name="can_focus">False</property> <property name="spacing">6</property> <child> <object class="GtkLabel" id="label"> @@ -56,7 +141,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">never</property> - <property name="vscrollbar_policy">automatic</property> <property name="shadow_type">in</property> <child> <object class="GtkTreeView" id="tree"> @@ -65,22 +149,28 @@ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="headers_visible">False</property> <property name="rules_hint">True</property> - <signal name="size_allocate" handler="on_confirm_tree_size_allocate"/> + <signal name="size-allocate" handler="on_confirm_tree_size_allocate" swapped="no"/> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> </object> </child> </object> <packing> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">1</property> </packing> </child> <child> <object class="GtkHBox" id="option_hbox"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="homogeneous">True</property> <child> <object class="GtkVBox" id="option_vbox"> <property name="visible">True</property> - <property name="orientation">vertical</property> + <property name="can_focus">False</property> <child> <placeholder/> </child> @@ -93,6 +183,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="draw_indicator">True</property> </object> @@ -106,6 +197,7 @@ </object> <packing> <property name="expand">False</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> @@ -121,17 +213,22 @@ </child> </object> <packing> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">1</property> </packing> </child> </object> <packing> + <property name="expand">False</property> + <property name="fill">True</property> <property name="position">1</property> </packing> </child> <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area1"> + <object class="GtkButtonBox" id="dialog-action_area1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="layout_style">end</property> <child> <object class="GtkButton" id="cancel"> @@ -140,6 +237,7 @@ <property name="can_focus">True</property> <property name="can_default">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -155,6 +253,7 @@ <property name="can_focus">True</property> <property name="can_default">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -170,6 +269,7 @@ <property name="can_focus">True</property> <property name="can_default">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -181,6 +281,7 @@ </object> <packing> <property name="expand">False</property> + <property name="fill">True</property> <property name="pack_type">end</property> <property name="position">1</property> </packing> @@ -193,7 +294,52 @@ <action-widget response="-5">ok</action-widget> </action-widgets> </object> + <object class="GtkWindow" id="conversion_log"> + <property name="can_focus">False</property> + <property name="border_width">4</property> + <property name="title" translatable="yes">Conversion Progress Display</property> + <child> + <object class="GtkVBox" id="conversion_vbox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">4</property> + <child> + <object class="GtkLabel" id="label463"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">The output of the background conversion scripts is copied below. Each page of the notebook corresponds to one background thread.</property> + <property name="use_markup">True</property> + <property name="justify">center</property> + <property name="wrap">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">8</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <object class="GtkStatusbar" id="conversion_statusbar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> <object class="GtkDialog" id="input_box"> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="border_width">5</property> <property name="resizable">False</property> @@ -202,20 +348,37 @@ <property name="destroy_with_parent">True</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox16"> + <object class="GtkBox" id="dialog-vbox16"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="orientation">vertical</property> <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area16"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="layout_style">end</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkHBox" id="hbox184"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="border_width">6</property> <property name="spacing">12</property> <child> <object class="GtkImage" id="image16"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="yalign">0</property> <property name="stock">gtk-dialog-question</property> @@ -230,12 +393,13 @@ <child> <object class="GtkVBox" id="vbox42"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkLabel" id="input_box_label"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="xalign">0</property> <property name="label"><span weight='bold' size='larger'>Message</span> @@ -253,13 +417,14 @@ The quick brown fox jumps over the lazy dog.</property> <child> <object class="GtkAlignment" id="alignment12"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="left_padding">12</property> <child> <object class="GtkVBox" id="vbox45"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkEntry" id="input_box_entry"> @@ -279,6 +444,7 @@ The quick brown fox jumps over the lazy dog.</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="draw_indicator">True</property> </object> @@ -299,65 +465,16 @@ The quick brown fox jumps over the lazy dog.</property> </child> </object> <packing> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">1</property> </packing> </child> </object> <packing> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area16"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="layout_style">end</property> - </object> - <packing> <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - </object> - <object class="GtkWindow" id="conversion_log"> - <property name="border_width">4</property> - <property name="title" translatable="yes">Conversion Progress Display</property> - <child> - <object class="GtkVBox" id="conversion_vbox"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">4</property> - <child> - <object class="GtkLabel" id="label463"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">The output of the background conversion scripts is copied below. Each page of the notebook corresponds to one background thread.</property> - <property name="use_markup">True</property> - <property name="justify">center</property> - <property name="wrap">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="padding">8</property> - <property name="position">0</property> - </packing> - </child> - <child> - <placeholder/> - </child> - <child> - <object class="GtkStatusbar" id="conversion_statusbar"> - <property name="visible">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">2</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> </object> diff --git a/libgtkpod/gp_itdb.c b/libgtkpod/gp_itdb.c index 6e5d54e..da9504c 100644 --- a/libgtkpod/gp_itdb.c +++ b/libgtkpod/gp_itdb.c @@ -788,7 +788,6 @@ void gp_track_cleanup_empty_strings (Track *track) void gp_init(int argc, char *argv[]) { gchar *cfgdir; - prefs_init(argc, argv); cfgdir = prefs_get_cfgdir(); itdbs_head = g_new0 (struct itdbs_head, 1); diff --git a/libgtkpod/prefs.h b/libgtkpod/prefs.h index 585f721..ed842e3 100644 --- a/libgtkpod/prefs.h +++ b/libgtkpod/prefs.h @@ -39,6 +39,8 @@ /* End-of-list marker for variable-length lists */ #define LIST_END_MARKER "----++++----" +#define DISABLE_SPLASH_SCREEN "disable-splash-screen" + #define CONVERT_TO_MP3_SCRIPT "convert-2mp3.sh" #define CONVERT_TO_M4A_SCRIPT "convert-2m4a.sh" #define CONVERT_TO_MP4_SCRIPT "convert-2mp4.sh" diff --git a/src/anjuta-app.c b/src/anjuta-app.c index ec9d76b..ea023f2 100644 --- a/src/anjuta-app.c +++ b/src/anjuta-app.c @@ -79,7 +79,7 @@ typedef struct { gpointer user_data2; } ConfData; -void anjuta_set_ui_file_path(gchar * path) { +void anjuta_set_ui_file_path(gchar *path) { uifile = path; } @@ -697,14 +697,30 @@ void anjuta_app_layout_reset(AnjutaApp *app) { } void anjuta_app_install_preferences(AnjutaApp *app) { - gchar *img_path; - GdkPixbuf *pixbuf; - GtkWidget *notebook, *shortcuts, *plugins, *remember_plugins; - - notebook = gtk_notebook_new(); - img_path = anjuta_res_get_pixmap_file(ICON_FILE); - pixbuf = gdk_pixbuf_new_from_file(img_path, NULL); - anjuta_preferences_dialog_add_page(ANJUTA_PREFERENCES_DIALOG(anjuta_preferences_get_dialog(app->preferences)), "plugins", _(" Plugins"), pixbuf, notebook); + GtkBuilder* builder = gtk_builder_new(); + GError* error = NULL; + GtkWidget *notebook, *splash_toggle, *shortcuts, *plugins, *remember_plugins; + + /* Create preferences page */ + gchar *glade_path = g_build_filename(get_glade_dir(), CORE_GTKPOD_XML, NULL); + gtk_builder_add_from_file(builder, glade_path, &error); + g_free(glade_path); + if (error) { + g_warning("Could not load general preferences: %s", error->message); + g_error_free(error); + return; + } + + splash_toggle = GTK_WIDGET(gtk_builder_get_object(builder, "preferences_disable_splash_screen")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(splash_toggle), prefs_get_int(DISABLE_SPLASH_SCREEN)); + + gtk_builder_connect_signals(builder, NULL); + + gchar *icon_path = g_build_filename(get_icon_dir(), ICON_FILE, NULL); + anjuta_preferences_add_from_builder(app->preferences, builder, app->settings, "General", _("General"), ICON_FILE); + g_free(icon_path); + + notebook = GTK_WIDGET(gtk_builder_get_object(builder, "General")); shortcuts = anjuta_ui_get_accel_editor(ANJUTA_UI(app->ui)); plugins = anjuta_plugin_manager_get_plugins_page(app->plugin_manager); remember_plugins = anjuta_plugin_manager_get_remembered_plugins_page(app->plugin_manager); @@ -717,9 +733,7 @@ void anjuta_app_install_preferences(AnjutaApp *app) { gtk_notebook_append_page(GTK_NOTEBOOK (notebook), remember_plugins, gtk_label_new(_("Preferred plugins"))); gtk_notebook_append_page(GTK_NOTEBOOK (notebook), shortcuts, gtk_label_new(_("Shortcuts"))); - g_object_unref(notebook); - g_free(img_path); - g_object_unref(pixbuf); + g_object_unref(builder); } /* AnjutaShell Implementation */ @@ -1594,6 +1608,10 @@ G_MODULE_EXPORT void on_confirm_tree_size_allocate(GtkWidget *sender, GtkAllocat g_object_set(renderer, "wrap-width", allocation->width, NULL); } +G_MODULE_EXPORT void on_disable_splash_screen_toggled(GtkToggleButton *togglebutton, gpointer user_data) { + prefs_set_int(DISABLE_SPLASH_SCREEN, gtk_toggle_button_get_active(togglebutton)); +} + ANJUTA_TYPE_BEGIN(AnjutaApp, anjuta_app, GTK_TYPE_WINDOW); ANJUTA_TYPE_ADD_INTERFACE( anjuta_shell, ANJUTA_TYPE_SHELL); ANJUTA_TYPE_ADD_INTERFACE( gtkpod_app, GTKPOD_APP_TYPE); diff --git a/src/gtkpod.c b/src/gtkpod.c index ab4d381..bdc9149 100644 --- a/src/gtkpod.c +++ b/src/gtkpod.c @@ -35,6 +35,7 @@ #include "libgtkpod/gtkpod_app_iface.h" #include "libgtkpod/misc.h" #include "libgtkpod/stock_icons.h" +#include "libgtkpod/prefs.h" #include "anjuta-app.h" #define GTKPOD_REMEMBERED_PLUGINS "remembered-plugins" @@ -91,18 +92,24 @@ void gtkpod_init(int argc, char *argv[]) { app = ANJUTA_APP(anjuta_app_new()); gtkpod_app = GTKPOD_APP(app); + /* Initialise the preferences as required for the display of the splash screen */ + prefs_init(argc, argv); + /* Show some progress as the app is initialised */ status = anjuta_shell_get_status(ANJUTA_SHELL(app), NULL); anjuta_status_progress_add_ticks(status, 1); - splash = g_build_filename(get_icon_dir(), "gtkpod-splash.png", NULL); - if (g_file_test(splash, G_FILE_TEST_IS_REGULAR)) - anjuta_status_set_splash(status, splash, 100); - else { - anjuta_status_disable_splash(status, TRUE); - } + /* Show the splash screen if user requires */ + if (! prefs_get_int(DISABLE_SPLASH_SCREEN)) { + splash = g_build_filename(get_icon_dir(), "gtkpod-splash.png", NULL); + if (g_file_test(splash, G_FILE_TEST_IS_REGULAR)) + anjuta_status_set_splash(status, splash, 100); + else { + anjuta_status_disable_splash(status, TRUE); + } - g_free(splash); + g_free(splash); + } /* * initialise gtkpod library items. Needs to be safety threaded due |