diff options
Diffstat (limited to 'embed')
-rw-r--r-- | embed/downloader-view.c | 61 | ||||
-rwxr-xr-x | embed/print-dialog.c | 32 |
2 files changed, 57 insertions, 36 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c index 9ac47c3ca..4877f03df 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -105,6 +105,12 @@ EphyDialogProperty properties [] = { NULL } }; +enum +{ + RESPONSE_PAUSE = 1, + RESPONSE_STOP = 2 +}; + static void downloader_view_build_ui (DownloaderView *dv); static void @@ -113,15 +119,14 @@ static void downloader_view_finalize (GObject *object); static void downloader_view_init (DownloaderView *dv); - -/* Callbacks */ -void -download_dialog_pause_cb (GtkButton *button, DownloaderView *dv); -void -download_dialog_abort_cb (GtkButton *button, DownloaderView *dv); -gboolean -download_dialog_delete_cb (GtkWidget *window, GdkEventAny *event, - DownloaderView *dv); +static void +download_dialog_response_cb (GtkWidget *dialog, + int response, + DownloaderView *dv); +static gboolean +download_dialog_delete_event_cb (GtkWidget *window, + GdkEventAny *event, + DownloaderView *dv); static GObjectClass *parent_class = NULL; @@ -365,7 +370,8 @@ update_buttons (DownloaderView *dv) } gtk_widget_set_sensitive (dv->priv->pause_button, pause_enabled); gtk_widget_set_sensitive (dv->priv->abort_button, abort_enabled); - gtk_button_set_label (GTK_BUTTON (dv->priv->pause_button), label_pause ? _("_Pause") : _("_Resume")); + gtk_button_set_label (GTK_BUTTON (dv->priv->pause_button), + label_pause ? _("_Pause") : _("_Resume")); } static void @@ -625,6 +631,11 @@ downloader_view_build_ui (DownloaderView *dv) properties[PROP_ABORT_BUTTON].id, &priv->abort_button, NULL); + g_signal_connect (priv->window, "response", + G_CALLBACK (download_dialog_response_cb), dv); + g_signal_connect (priv->window, "delete-event", + G_CALLBACK (download_dialog_delete_event_cb), dv); + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)), GTK_SELECTION_BROWSE); @@ -695,8 +706,8 @@ downloader_view_build_ui (DownloaderView *dv) g_signal_connect (selection, "changed", G_CALLBACK (selection_changed), dv); } -void -download_dialog_pause_cb (GtkButton *button, DownloaderView *dv) +static void +download_dialog_pause (DownloaderView *dv) { GtkTreeSelection *selection; GtkTreeModel *model; @@ -794,8 +805,8 @@ downloader_view_remove_download (DownloaderView *dv, EphyDownload *download) } } -void -download_dialog_abort_cb (GtkButton *button, DownloaderView *dv) +static void +download_dialog_stop (DownloaderView *dv) { GValue val = {0, }; GtkTreeSelection *selection; @@ -818,9 +829,25 @@ download_dialog_abort_cb (GtkButton *button, DownloaderView *dv) g_value_unset (&val); } -gboolean -download_dialog_delete_cb (GtkWidget *window, GdkEventAny *event, - DownloaderView *dv) +static void +download_dialog_response_cb (GtkWidget *dialog, + int response, + DownloaderView *dv) +{ + if (response == RESPONSE_PAUSE) + { + download_dialog_pause (dv); + } + else if (response == RESPONSE_STOP) + { + download_dialog_stop (dv); + } +} + +static gboolean +download_dialog_delete_event_cb (GtkWidget *window, + GdkEventAny *event, + DownloaderView *dv) { /* FIXME multi-head */ if (egg_tray_manager_check_running (gdk_screen_get_default ())) diff --git a/embed/print-dialog.c b/embed/print-dialog.c index 05b93749e..a2eb47d33 100755 --- a/embed/print-dialog.c +++ b/embed/print-dialog.c @@ -80,14 +80,6 @@ EphyDialogProperty setup_props [] = { NULL } }; -void ephy_print_dialog_response_cb (GtkDialog *dialog, - int response, - EmbedPrintInfo *info); -void ephy_print_setup_dialog_close_button_cb (GtkWidget *widget, - EphyDialog *dialog); -void ephy_print_setup_dialog_help_button_cb (GtkWidget *widget, - EphyDialog *dialog); - void ephy_print_info_free (EmbedPrintInfo *info) { @@ -346,18 +338,18 @@ ephy_print_do_print_and_free (EmbedPrintInfo *info) info); } -void -ephy_print_setup_dialog_close_button_cb (GtkWidget *widget, - EphyDialog *dialog) +static void +ephy_print_setup_dialog_response_cb (GtkWidget *widget, + int response, + EphyDialog *dialog) { - g_object_unref (dialog); -} + if (response == GTK_RESPONSE_HELP) + { + ephy_gui_help (GTK_WINDOW (widget), "epiphany", "using-print-setup"); + return; + } -void -ephy_print_setup_dialog_help_button_cb (GtkWidget *widget, - EphyDialog *dialog) -{ - ephy_gui_help (GTK_WINDOW (dialog), "epiphany", "using-print-setup"); + g_object_unref (dialog); } static GtkWidget * @@ -483,7 +475,9 @@ ephy_print_setup_dialog_new (void) window = ephy_dialog_get_control (dialog, setup_props[SETUP_WINDOW_PROP].id); gtk_window_set_icon_name (GTK_WINDOW (window), STOCK_PRINT_SETUP); - + g_signal_connect (window, "response", + G_CALLBACK (ephy_print_setup_dialog_response_cb), dialog); + paper_selector_hbox = ephy_dialog_get_control (dialog, setup_props[PAPER_SELECTOR_PROP].id); gtk_box_pack_start_defaults (GTK_BOX (paper_selector_hbox), |