commit 30951d27251a1af9497f929c32d3728100a71d30 Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> Date: Sat Jan 21 19:07:29 2012 +0000
Fix errors to get the sj gui to appear cleanly * configure.ac * gstreamer-pbutils is required * Split out the SOUND_JUICER package checks since brasero is needed to be checked on initialisation of main app. * Declare and link both gstreamer and brasero so that their goptions can be properly checked when starting gtkpod. This is necessary in the case of gstreamer as certain arrays and hashmaps in gstvalue are only inited via the parsing of the gst_init_option_group function. * plugins/sjcd * Needs to link against brasero and canberra explicitly due to configure changes * Restore stock_init function for loading the CD extract icon * Audio volume changed callback not required * Remove some exit(1)s * Remove destroy callbacks * src/main.c * Support for goption use on the command line configure.ac | 34 +++++++++++++----- plugins/sjcd/Makefile.am | 6 ++- plugins/sjcd/sj-extracting.c | 4 -- plugins/sjcd/sj-main.c | 77 ++++++++++++++++------------------------- plugins/sjcd/sjcd.xml | 14 ++++++- src/main.c | 30 ++++++++++++++++- 6 files changed, 100 insertions(+), 65 deletions(-) --- diff --git a/configure.ac b/configure.ac index 4c99269..079c176 100644 --- a/configure.ac +++ b/configure.ac @@ -94,10 +94,11 @@ echo "Checking optional dependencies" PKG_CHECK_MODULES(CLUTTER_GTK, [clutter-gtk-1.0 >= 1.0], [have_clutter_gtk="yes"], [have_clutter_gtk="no"]) PKG_CHECK_MODULES(CURL, [libcurl >= 7.10.0], [have_curl="yes"], [have_curl="no"]) PKG_CHECK_MODULES(WEBKIT, [webkitgtk-3.0 >= 1.3], [have_webkit="yes"], [have_webkit="no"]) -PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10 >= 0.10.25 gstreamer-interfaces-0.10 >= 0.10.25, [have_gstreamer="yes"], [have_gstreamer="no"]) +PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10 >= 0.10.25 gstreamer-base-0.10 >= 0.10.25 gstreamer-plugins-base-0.10 >= 0.10.25 gstreamer-interfaces-0.10 >= 0.10.25 gstreamer-pbutils-0.10 >= 0.10.25, [have_gstreamer="yes"], [have_gstreamer="no"]) PKG_CHECK_MODULES(VORBISFILE, vorbisfile >= 1.3.1, [have_vorbis="yes"], [have_vorbis="no"]) PKG_CHECK_MODULES(FLAC, flac >= 1.2.1, [have_flac="yes"], [have_flac="no"]) -PKG_CHECK_MODULES(SOUND_JUICER, libcanberra-gtk3 libbrasero-media3 >= 3.0, [have_sj="yes"], [have_sj="no"]) +PKG_CHECK_MODULES(BRASERO, libbrasero-media3 >= 3.0, [have_brasero="yes"], [have_brasero="no"]) +PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3, [have_canberra="yes"], [have_canberra="no"]) GTK_CLEANLINESS_FLAGS="-DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE" @@ -161,6 +162,23 @@ if test "x$have_clutter_gtk" = "xyes"; then fi AM_CONDITIONAL(HAVE_CLUTTER_GTK, [test "x$have_clutter_gtk" = "xyes"]) +dnl Add gstreamer if installed +dnl ------------------------------------------------------------- +if test "x$have_gstreamer" = "xyes"; then + AC_DEFINE(HAVE_GSTREAMER, 1, [Define if you have gstreamer support]) + dnl Need to add to CFLAGS and LIBS so main can init correctly + CFLAGS="$CFLAGS $GSTREAMER_CFLAGS" + LIBS="$LIBS $GSTREAMER_LIBS" +fi + +dnl Add brasero if installed +dnl ------------------------------------------------------------- +if test "x$have_brasero" = "xyes"; then + AC_DEFINE(HAVE_BRASERO, 1, [Define if you have brasero support]) + dnl Need to add to CFLAGS and LIBS so main can init correctly + CFLAGS="$CFLAGS $BRASERO_CFLAGS" + LIBS="$LIBS $BRASERO_LIBS" +fi dnl Check for libcurl dnl ------------------------------------------------------------- @@ -339,17 +357,15 @@ if test "$user_disabled_sjcd" = 1; then else AC_MSG_RESULT(no) AC_MSG_CHECKING(sjcd plugin dependencies) - if test "x$have_gstreamer" = "xyes" -a "x$have_sj" = "xyes"; then + if test "x$have_gstreamer" = "xyes" -a "x$have_brasero" = "xyes" -a "x$have_canberra" = "xyes"; then AC_MSG_RESULT(yes) have_sjcd="yes" dnl Checks for components of gstreamer - if test "x$have_gstreamer" = "xyes"; then - AM_GST_ELEMENT_CHECK(vorbisenc,,AC_MSG_WARN([The 'vorbisenc' element was not found. This will cause encoding to Ogg Vorbis to fail.])) - AM_GST_ELEMENT_CHECK(flacenc,,AC_MSG_WARN([The 'flacenc' element was not found. This will cause encoding to FLAC to fail.])) - AM_GST_ELEMENT_CHECK(wavenc,,AC_MSG_WARN([The 'wavenc' element was not found. This will cause encoding to Wave to fail.])) - AM_GST_ELEMENT_CHECK(giosink,,AC_MSG_WARN([The 'giosink' element was not found. This will cause Sound Juicer to fail at runtime.])) - fi + AM_GST_ELEMENT_CHECK(vorbisenc,,AC_MSG_WARN([The 'vorbisenc' element was not found. This will cause encoding to Ogg Vorbis to fail.])) + AM_GST_ELEMENT_CHECK(flacenc,,AC_MSG_WARN([The 'flacenc' element was not found. This will cause encoding to FLAC to fail.])) + AM_GST_ELEMENT_CHECK(wavenc,,AC_MSG_WARN([The 'wavenc' element was not found. This will cause encoding to Wave to fail.])) + AM_GST_ELEMENT_CHECK(giosink,,AC_MSG_WARN([The 'giosink' element was not found. This will cause Sound Juicer to fail at runtime.])) else AC_MSG_RESULT(no) fi diff --git a/plugins/sjcd/Makefile.am b/plugins/sjcd/Makefile.am index fcf3373..f5aa0e6 100644 --- a/plugins/sjcd/Makefile.am +++ b/plugins/sjcd/Makefile.am @@ -40,7 +40,8 @@ libsjcd_la_SOURCES = plugin.c plugin.h \ libsjcd_la_CFLAGS = -I$(top_srcdir)/plugins/$(plugin_name)/libjuicer \ $(GSTREAMER_CFLAGS) \ - $(SOUND_JUICER_CFLAGS) \ + $(BRASERO_CFLAGS) \ + $(CANBERRA_CFLAGS) \ $(MUSICBRAINZ3_CFLAGS) libsjcd_la_LDFLAGS = $(GTKPOD_PLUGIN_LDFLAGS) @@ -51,7 +52,8 @@ libsjcd_la_LIBADD = \ $(GTKPOD_LIBS) \ $(LIBANJUTA_LIBS) \ $(GSTREAMER_LIBS) \ - $(SOUND_JUICER_LIBS) \ + $(BRASERO_LIBS) \ + $(CANBERRA_LIBS) \ $(MUSICBRAINZ3_LIBS) endif diff --git a/plugins/sjcd/sj-extracting.c b/plugins/sjcd/sj-extracting.c index 53f26d4..953ee75 100644 --- a/plugins/sjcd/sj-extracting.c +++ b/plugins/sjcd/sj-extracting.c @@ -244,14 +244,12 @@ cleanup (void) gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 0); gtk_widget_hide (progress_bar); - gtk_widget_set_sensitive (play_button, TRUE); gtk_widget_set_sensitive (title_entry, TRUE); gtk_widget_set_sensitive (artist_entry, TRUE); gtk_widget_set_sensitive (genre_entry, TRUE); gtk_widget_set_sensitive (year_entry, TRUE); gtk_widget_set_sensitive (disc_number_entry, TRUE); /* Enabling the Menuitem */ - gtk_widget_set_sensitive (play_menuitem, TRUE); gtk_widget_set_sensitive (extract_menuitem, TRUE); gtk_widget_set_sensitive (reread_menuitem, TRUE); gtk_widget_set_sensitive (select_all_menuitem, TRUE); @@ -799,7 +797,6 @@ on_extract_activate (GtkWidget *button, gpointer user_data) update_speed_progress (NULL, 0.0, -1); /* Disable the widgets in the main UI*/ - gtk_widget_set_sensitive (play_button, FALSE); gtk_widget_set_sensitive (title_entry, FALSE); gtk_widget_set_sensitive (artist_entry, FALSE); gtk_widget_set_sensitive (genre_entry, FALSE); @@ -807,7 +804,6 @@ on_extract_activate (GtkWidget *button, gpointer user_data) gtk_widget_set_sensitive (disc_number_entry, FALSE); /* Disable the menuitems in the main menu*/ - gtk_widget_set_sensitive (play_menuitem, FALSE); gtk_widget_set_sensitive (extract_menuitem, FALSE); gtk_widget_set_sensitive (reread_menuitem, FALSE); gtk_widget_set_sensitive (select_all_menuitem, FALSE); diff --git a/plugins/sjcd/sj-main.c b/plugins/sjcd/sj-main.c index a40f03b..4604008 100644 --- a/plugins/sjcd/sj-main.c +++ b/plugins/sjcd/sj-main.c @@ -53,8 +53,6 @@ #include "sj-prefs.h" #include "sj-genres.h" -gboolean on_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); - static void reread_cd (gboolean ignore_no_media); static void update_ui_for_album (AlbumDetails *album); static void set_duplication (gboolean enable); @@ -105,6 +103,31 @@ static char *current_submit_url = NULL; #define RAISE_WINDOW "raise-window" #define SJCD_SCHEMA "org.gtkpod.sjcd" +void +sj_stock_init (void) +{ + static gboolean initialized = FALSE; + static GtkIconFactory *sj_icon_factory = NULL; + + static const GtkStockItem sj_stock_items[] = + { + { SJ_STOCK_EXTRACT, N_("E_xtract"), GDK_CONTROL_MASK, GDK_KEY_Return, NULL } + }; + + if (initialized) + return; + + sj_icon_factory = gtk_icon_factory_new (); + + gtk_icon_factory_add (sj_icon_factory, SJ_STOCK_EXTRACT, gtk_icon_factory_lookup_default (GTK_STOCK_CDROM)); + + gtk_icon_factory_add_default (sj_icon_factory); + + gtk_stock_add_static (sj_stock_items, G_N_ELEMENTS (sj_stock_items)); + + initialized = TRUE; +} + static void error_on_start (GError *error) { gtkpod_statusbar_message("Could not start sound juicer because %s", error->message); @@ -119,29 +142,6 @@ G_MODULE_EXPORT void on_eject_activate (GtkMenuItem *item, gpointer user_data) brasero_drive_eject (drive, FALSE, NULL); } -G_MODULE_EXPORT gboolean on_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) -{ - if (extracting) { - GtkWidget *dialog; - int response; - - dialog = gtk_message_dialog_new (GTK_WINDOW (gtkpod_app), GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, - _("You are currently extracting a CD. Do you want to quit now or continue?")); - gtk_dialog_add_button (GTK_DIALOG (dialog), "gtk-quit", GTK_RESPONSE_ACCEPT); - gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Continue"), GTK_RESPONSE_REJECT); - response = gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - if (response == GTK_RESPONSE_ACCEPT) { - return FALSE; - } - return TRUE; - } - return FALSE; -} - static gboolean select_all_foreach_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, @@ -649,17 +649,6 @@ static void open_changed_cb (GSettings *settings, gchar *key, gpointer user_data open_finished = g_settings_get_boolean (settings, key); } - /** - * The GSettings key for audio volume changes - */ -static void audio_volume_changed_cb (GSettings *settings, gchar *key, gpointer user_data) -{ - g_assert (strcmp (key, SJ_SETTINGS_AUDIO_VOLUME) == 0); - - GtkWidget *volb = GET_WIDGET ("volume_button"); - gtk_scale_button_set_value (GTK_SCALE_BUTTON (volb), g_settings_get_double (settings, key)); -} - static void metadata_cb (SjMetadataGetter *m, GList *albums, GError *error) { @@ -975,7 +964,7 @@ static void device_changed_cb (GSettings *settings, gchar *key, gpointer user_da _("Sound Juicer could not find any CD-ROM drives to read.")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - exit (1); + return; #endif } } else { @@ -1014,7 +1003,7 @@ static void profile_changed_cb (GSettings *settings, gchar *key, gpointer user_d on_edit_preferences_cb (NULL, NULL); } else { /* Can't use gtk_main_quit here, we may be outside the main loop */ - exit(0); + return; } } @@ -1458,6 +1447,8 @@ GtkWidget *sj_create_sound_juicer() g_setenv ("PULSE_PROP_media.role", "music", TRUE); + sj_stock_init(); + connection = bacon_message_connection_new ("sound-juicer"); if (bacon_message_connection_get_is_server (connection) == FALSE) { bacon_message_connection_send (connection, RAISE_WINDOW); @@ -1496,13 +1487,11 @@ GtkWidget *sj_create_sound_juicer() (GCallback)path_pattern_changed_cb, NULL); g_signal_connect (sj_settings, "changed::"SJ_SETTINGS_FILE_PATTERN, (GCallback)file_pattern_changed_cb, NULL); - g_signal_connect (sj_settings, "changed::"SJ_SETTINGS_AUDIO_VOLUME, - (GCallback)audio_volume_changed_cb, NULL); http_settings = g_settings_new ("org.gnome.system.proxy.http"); if (http_settings == NULL) { g_warning (_("Could not create GSettings object.\n")); - exit (1); + return NULL; } g_signal_connect (http_settings, "changed::"SJ_SETTINGS_HTTP_PROXY_ENABLE, (GCallback)http_proxy_enable_changed_cb, NULL); @@ -1623,7 +1612,6 @@ GtkWidget *sj_create_sound_juicer() strip_changed_cb (sj_settings, SJ_SETTINGS_STRIP, NULL); eject_changed_cb (sj_settings, SJ_SETTINGS_EJECT, NULL); open_changed_cb (sj_settings, SJ_SETTINGS_OPEN, NULL); - audio_volume_changed_cb (sj_settings, SJ_SETTINGS_AUDIO_VOLUME, NULL); if (device == NULL && uris == NULL) { /* FIXME: this should set the device gsettings key to a meaningful * value if it's empty (which is the case until the user changes it in @@ -1670,11 +1658,6 @@ GtkWidget *sj_create_sound_juicer() gtk_widget_set_sensitive (duplicate, FALSE); duplication_enabled = is_cd_duplication_available(); - g_object_unref (base_uri); - g_object_unref (metadata); - g_object_unref (extractor); - g_object_unref (sj_settings); - g_object_unref (http_settings); brasero_media_library_stop (); return vbox1; diff --git a/plugins/sjcd/sjcd.xml b/plugins/sjcd/sjcd.xml index c8024c7..f8f7a79 100644 --- a/plugins/sjcd/sjcd.xml +++ b/plugins/sjcd/sjcd.xml @@ -6,8 +6,6 @@ <property name="height_request">420</property> <property name="can_focus">False</property> <property name="title" translatable="yes">Sound Juicer</property> - <signal name="destroy" handler="on_destroy_signal" swapped="no"/> - <signal name="delete-event" handler="on_delete_event" swapped="no"/> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> @@ -786,6 +784,18 @@ </packing> </child> <child> + <object class="BraseroDriveSelection" id="cd_option"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> <object class="GtkCheckButton" id="check_eject"> <property name="label" translatable="yes">_Eject after extracting tracks</property> <property name="visible">True</property> diff --git a/src/main.c b/src/main.c index 7a31611..f9e2552 100644 --- a/src/main.c +++ b/src/main.c @@ -38,11 +38,19 @@ #ifdef HAVE_CLUTTER_GTK #include <clutter-gtk/clutter-gtk.h> #endif - +#ifdef HAVE_GSTREAMER + #include <gst/gst.h> +#endif +#ifdef HAVE_BRASERO + #include <brasero-media.h> +#endif int main (int argc, char *argv[]) { + GOptionContext *ctx; + GError *error = NULL; + #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); @@ -64,6 +72,26 @@ main (int argc, char *argv[]) gtk_init (&argc, &argv); #endif + ctx = g_option_context_new (N_("- Interface with your ipod")); + g_option_context_add_group (ctx, gtk_get_option_group (TRUE)); + +#ifdef HAVE_GSTREAMER + g_option_context_add_group (ctx, gst_init_get_option_group ()); +#endif + +#ifdef HAVE_BRASERO + g_option_context_add_group (ctx, brasero_media_get_option_group ()); +#endif + + g_option_context_set_ignore_unknown_options (ctx, TRUE); + g_option_context_parse (ctx, &argc, &argv, &error); + if (error != NULL) { + g_printerr ("Error parsing options: %s", error->message); + g_error_free(error); + exit(1); + } + g_option_context_free (ctx); + g_set_application_name(_("gtkpod")); gtk_window_set_auto_startup_notification(FALSE); ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2