diff --git a/ChangeLog b/ChangeLog index 08814ffef1e4838d3e3b64f3a91fde5eabb752ee..492466befa9c79235d8e078a990b531a68cb0e1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-11-03 jeromeg + + * configure.ac.in: Display build options. + * lib/screenshooter-dialog.c: + - (cb_combo_active_item_changed) Fix prototype and do not free sd->app as it + makes the plugin segfault. + * lib/screenshooter-utils.c: + - (screenshooter_open_screenshot) Display the error with xfce_err if any. + * TODO: updated. + 2008-11-03 jeromeg * TODO: updated. diff --git a/TODO b/TODO index f32780b201dcfe5440bef46d251761b2bb47be99..e40506ff1d75b4d0d9c196912855e2c9b6c38299 100755 --- a/TODO +++ b/TODO @@ -1,8 +1,6 @@ -* Add open with support to the plugin. * Write some documentation. * Update the code comments. * Update the website. -* Correctly free the stuff in the GLists in screenshooter-dialogs.c Low priority: * Try to get borders captured with compiz. diff --git a/configure.ac.in b/configure.ac.in index 45c8c9f3cb43750ceaea71c59105d2e1a7b92fa8..ef6d7a71593e3752bdb6ad312a30abf7a8528abb 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -70,3 +70,15 @@ panel-plugin/Makefile po/Makefile.in ]) +dnl *************************** +dnl *** Print configuration *** +dnl *************************** + +echo "Build Configuration:" + +if test x"$GIO_FOUND" = x"yes"; then +echo "* Open with support: yes" +else +echo "* Open with support: no" +fi + diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c index 1d7cea113f9286f204a52f1b7ce550d8dcf605d5..51f181fcd0e3537c7fd574ed4e360e3c1a03a8b5 100644 --- a/lib/screenshooter-dialogs.c +++ b/lib/screenshooter-dialogs.c @@ -34,7 +34,7 @@ static void cb_default_folder (GtkWidget *chooser, static void cb_delay_spinner_changed (GtkWidget *spinner, ScreenshotData *sd); #ifdef HAVE_GIO -static void cb_combo_active_item_changed (GtkComboBox *box, +static void cb_combo_active_item_changed (GtkWidget *box, ScreenshotData *sd); static void add_item (GAppInfo *app_info, GtkWidget *liststore); @@ -106,7 +106,7 @@ static void cb_delay_spinner_changed (GtkWidget *spinner, -static void cb_combo_active_item_changed (GtkComboBox *box, ScreenshotData *sd) +static void cb_combo_active_item_changed (GtkWidget *box, ScreenshotData *sd) { GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (box)); GtkTreeIter iter; @@ -116,10 +116,7 @@ static void cb_combo_active_item_changed (GtkComboBox *box, ScreenshotData *sd) gtk_tree_model_get (model, &iter, 2, &active_command, -1); - if (sd->app != NULL) - g_free (sd->app); - - sd->app = active_command; + sd->app = active_command; } diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c index 14ce0d980f173526d3576f0e7f529a0f7010d70a..c860dd2f1b78a805c7d03a6e032827c920e2f148 100644 --- a/lib/screenshooter-utils.c +++ b/lib/screenshooter-utils.c @@ -360,7 +360,15 @@ screenshooter_open_screenshot (gchar *screenshot_path, gchar *command = g_strconcat (application, " ", screenshot_path, NULL); - xfce_exec (command, FALSE, TRUE, NULL); + GError *error = NULL; + + if (!xfce_exec_on_screen (gdk_screen_get_default (), command, FALSE, TRUE, &error)) + { + xfce_err (error->message); + g_error_free (error); + } + + g_free (command); } } } diff --git a/panel-plugin/screenshooter-plugin.c b/panel-plugin/screenshooter-plugin.c index 58bc6fc25ea7e33959f2acbfc1358c6e76766a2a..93ef45ca85087543948f7a9aec036187ae3a5064 100755 --- a/panel-plugin/screenshooter-plugin.c +++ b/panel-plugin/screenshooter-plugin.c @@ -138,6 +138,7 @@ cb_free_data (XfcePanelPlugin *plugin, PluginData *pd) pd->style_id = 0; g_free (pd->sd->screenshot_dir); + g_free (pd->sd->app); g_free (pd->sd); g_free (pd); } @@ -152,6 +153,7 @@ static void cb_button_clicked (GtkWidget *button, PluginData *pd) { GdkPixbuf *screenshot; + gchar *screenshot_path = NULL; /* Make the button unclickable so that the user does not press it while another screenshot is in progress */ @@ -160,12 +162,19 @@ cb_button_clicked (GtkWidget *button, PluginData *pd) /* Get the screenshot */ screenshot = screenshooter_take_screenshot (pd->sd->mode, pd->sd->delay); - screenshooter_save_screenshot (screenshot, pd->sd->show_save_dialog, - pd->sd->screenshot_dir); + screenshot_path = + screenshooter_save_screenshot (screenshot, pd->sd->show_save_dialog, + pd->sd->screenshot_dir); + + g_object_unref (screenshot); + + if (screenshot_path != NULL) + { + screenshooter_open_screenshot (screenshot_path, pd->sd->app); + g_free (screenshot_path); + } gtk_widget_set_sensitive (GTK_WIDGET (pd->button), TRUE); - - g_object_unref (screenshot); } diff --git a/src/main.c b/src/main.c index 49dffb38bb547472c3f49b2d7417e538eb0471ac..ae82c0834b843d2fe426927fb20f2e8bb03c8d33 100644 --- a/src/main.c +++ b/src/main.c @@ -214,6 +214,7 @@ int main(int argc, char **argv) } g_free (sd->screenshot_dir); + g_free (sd->app); g_free (sd); g_free (rc_file);