Make download folder and notifications obligatory
This commit is contained in:
parent
e8d2dc3ee7
commit
2d4afde696
4 changed files with 6 additions and 94 deletions
|
@ -365,15 +365,6 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
INDENTED_ADD (label);
|
||||
button = katze_property_proxy (settings, "download-folder", "folder");
|
||||
SPANNED_ADD (button);
|
||||
label = katze_property_proxy (settings, "ask-for-destination-folder", NULL);
|
||||
INDENTED_ADD (label);
|
||||
#if HAVE_LIBNOTIFY
|
||||
if (notify_is_initted () || g_find_program_in_path ("notify-send"))
|
||||
{
|
||||
button = katze_property_proxy (settings, "notify-transfer-completed", NULL);
|
||||
SPANNED_ADD (button);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Page "Appearance" */
|
||||
|
|
|
@ -92,7 +92,6 @@ struct _MidoriView
|
|||
gboolean speed_dial_in_new_tabs;
|
||||
gchar* download_manager;
|
||||
gchar* news_aggregator;
|
||||
gboolean ask_for_destination_folder;
|
||||
gboolean middle_click_opens_selection;
|
||||
gboolean open_tabs_in_the_background;
|
||||
gboolean close_buttons_on_tabs;
|
||||
|
@ -1990,11 +1989,8 @@ midori_web_view_menu_save_activate_cb (GtkWidget* widget,
|
|||
WebKitDownload* download = webkit_download_new (request);
|
||||
gboolean handled;
|
||||
g_object_unref (request);
|
||||
if (view->ask_for_destination_folder)
|
||||
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
|
||||
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
|
||||
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
|
||||
if (!view->ask_for_destination_folder)
|
||||
webkit_download_start (download);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2025,11 +2021,8 @@ midori_web_view_menu_image_save_activate_cb (GtkWidget* widget,
|
|||
WebKitDownload* download = webkit_download_new (request);
|
||||
gboolean handled;
|
||||
g_object_unref (request);
|
||||
if (view->ask_for_destination_folder)
|
||||
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
|
||||
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
|
||||
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
|
||||
if (!view->ask_for_destination_folder)
|
||||
webkit_download_start (download);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -2051,11 +2044,8 @@ midori_web_view_menu_video_save_activate_cb (GtkWidget* widget,
|
|||
WebKitDownload* download = webkit_download_new (request);
|
||||
gboolean handled;
|
||||
g_object_unref (request);
|
||||
if (view->ask_for_destination_folder)
|
||||
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
|
||||
g_object_set_data (G_OBJECT (download), "save-as-download", (void*)0xdeadbeef);
|
||||
g_signal_emit (view, signals[DOWNLOAD_REQUESTED], 0, download, &handled);
|
||||
if (!view->ask_for_destination_folder)
|
||||
webkit_download_start (download);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -2421,8 +2411,7 @@ midori_view_populate_popup (MidoriView* view,
|
|||
_("Copy Link de_stination"), NULL,
|
||||
G_CALLBACK (midori_web_view_menu_link_copy_activate_cb), widget);
|
||||
midori_view_insert_menu_item (menu_shell, -1,
|
||||
view->ask_for_destination_folder ? _("_Save Link destination")
|
||||
: _("_Download Link destination"), NULL,
|
||||
_("_Save Link destination"), NULL,
|
||||
G_CALLBACK (midori_web_view_menu_save_activate_cb), widget);
|
||||
if (view->download_manager && *view->download_manager)
|
||||
midori_view_insert_menu_item (menu_shell, -1,
|
||||
|
@ -2441,8 +2430,7 @@ midori_view_populate_popup (MidoriView* view,
|
|||
_("Copy Image _Address"), NULL,
|
||||
G_CALLBACK (midori_web_view_menu_image_copy_activate_cb), widget);
|
||||
midori_view_insert_menu_item (menu_shell, -1,
|
||||
view->ask_for_destination_folder ? _("Save I_mage")
|
||||
: _("Download I_mage"), GTK_STOCK_SAVE,
|
||||
_("Save I_mage"), GTK_STOCK_SAVE,
|
||||
G_CALLBACK (midori_web_view_menu_image_save_activate_cb), widget);
|
||||
}
|
||||
|
||||
|
@ -3319,7 +3307,6 @@ _midori_view_set_settings (MidoriView* view,
|
|||
"kinetic-scrolling", &kinetic_scrolling,
|
||||
"close-buttons-on-tabs", &view->close_buttons_on_tabs,
|
||||
"open-new-pages-in", &view->open_new_pages_in,
|
||||
"ask-for-destination-folder", &view->ask_for_destination_folder,
|
||||
"middle-click-opens-selection", &view->middle_click_opens_selection,
|
||||
"open-tabs-in-the-background", &view->open_tabs_in_the_background,
|
||||
"find-while-typing", &view->find_while_typing,
|
||||
|
@ -3396,8 +3383,6 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings,
|
|||
}
|
||||
else if (name == g_intern_string ("open-new-pages-in"))
|
||||
view->open_new_pages_in = g_value_get_enum (&value);
|
||||
else if (name == g_intern_string ("ask-for-destination-folder"))
|
||||
view->ask_for_destination_folder = g_value_get_boolean (&value);
|
||||
else if (name == g_intern_string ("middle-click-opens-selection"))
|
||||
view->middle_click_opens_selection = g_value_get_boolean (&value);
|
||||
else if (name == g_intern_string ("open-tabs-in-the-background"))
|
||||
|
|
|
@ -46,8 +46,6 @@ struct _MidoriWebSettings
|
|||
MidoriStartup load_on_startup : 2;
|
||||
gboolean show_crash_dialog : 1;
|
||||
gboolean speed_dial_in_new_tabs : 1;
|
||||
gboolean ask_for_destination_folder : 1;
|
||||
gboolean notify_transfer_completed : 1;
|
||||
MidoriPreferredEncoding preferred_encoding : 3;
|
||||
gboolean always_show_tabbar : 1;
|
||||
gboolean close_buttons_on_tabs : 1;
|
||||
|
@ -130,8 +128,6 @@ enum
|
|||
PROP_SHOW_CRASH_DIALOG,
|
||||
PROP_SPEED_DIAL_IN_NEW_TABS,
|
||||
PROP_DOWNLOAD_FOLDER,
|
||||
PROP_ASK_FOR_DESTINATION_FOLDER,
|
||||
PROP_NOTIFY_TRANSFER_COMPLETED,
|
||||
PROP_DOWNLOAD_MANAGER,
|
||||
PROP_TEXT_EDITOR,
|
||||
PROP_NEWS_AGGREGATOR,
|
||||
|
@ -676,52 +672,6 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
|||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MidoriWebSettings:ask-for-destination-folder:
|
||||
*
|
||||
* Whether to ask for the destination folder when downloading a file.
|
||||
*
|
||||
* Note: Only since 0.2.0 is this value actually used.
|
||||
*
|
||||
* Since: 0.1.7
|
||||
*
|
||||
* Deprecated: 0.3.0
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ASK_FOR_DESTINATION_FOLDER,
|
||||
g_param_spec_boolean (
|
||||
"ask-for-destination-folder",
|
||||
_("Ask for the destination folder"),
|
||||
_("Whether to ask for the destination folder when downloading a file"),
|
||||
FALSE,
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 15)
|
||||
flags));
|
||||
#else
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MidoriWebSettings:notify-transfer-completed:
|
||||
*
|
||||
* Whether to show a notification when a transfer has been completed.
|
||||
*
|
||||
* Since: 0.1.7
|
||||
*
|
||||
* Deprecated: 0.3.0
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_NOTIFY_TRANSFER_COMPLETED,
|
||||
g_param_spec_boolean (
|
||||
"notify-transfer-completed",
|
||||
_("Notify when a transfer has been completed"),
|
||||
_("Whether to show a notification when a transfer has been completed"),
|
||||
TRUE,
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 3)
|
||||
flags));
|
||||
#else
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
#endif
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DOWNLOAD_MANAGER,
|
||||
g_param_spec_string (
|
||||
|
@ -1168,7 +1118,6 @@ notify_default_encoding_cb (GObject* object,
|
|||
static void
|
||||
midori_web_settings_init (MidoriWebSettings* web_settings)
|
||||
{
|
||||
web_settings->notify_transfer_completed = TRUE;
|
||||
web_settings->download_folder = g_strdup (midori_get_download_dir ());
|
||||
web_settings->http_proxy = NULL;
|
||||
web_settings->show_panel_controls = TRUE;
|
||||
|
@ -1376,12 +1325,6 @@ midori_web_settings_set_property (GObject* object,
|
|||
case PROP_DOWNLOAD_FOLDER:
|
||||
katze_assign (web_settings->download_folder, g_value_dup_string (value));
|
||||
break;
|
||||
case PROP_ASK_FOR_DESTINATION_FOLDER:
|
||||
web_settings->ask_for_destination_folder = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_NOTIFY_TRANSFER_COMPLETED:
|
||||
web_settings->notify_transfer_completed = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_DOWNLOAD_MANAGER:
|
||||
katze_assign (web_settings->download_manager, g_value_dup_string (value));
|
||||
break;
|
||||
|
@ -1654,12 +1597,6 @@ midori_web_settings_get_property (GObject* object,
|
|||
case PROP_DOWNLOAD_FOLDER:
|
||||
g_value_set_string (value, web_settings->download_folder);
|
||||
break;
|
||||
case PROP_ASK_FOR_DESTINATION_FOLDER:
|
||||
g_value_set_boolean (value, web_settings->ask_for_destination_folder);
|
||||
break;
|
||||
case PROP_NOTIFY_TRANSFER_COMPLETED:
|
||||
g_value_set_boolean (value, web_settings->notify_transfer_completed);
|
||||
break;
|
||||
case PROP_DOWNLOAD_MANAGER:
|
||||
g_value_set_string (value, web_settings->download_manager);
|
||||
break;
|
||||
|
|
|
@ -107,14 +107,13 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
|
|||
case WEBKIT_DOWNLOAD_STATUS_FINISHED:
|
||||
{
|
||||
MidoriBrowser* browser = midori_browser_get_for_widget (button);
|
||||
MidoriWebSettings* settings = midori_browser_get_settings (browser);
|
||||
|
||||
icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
|
||||
gtk_button_set_image (GTK_BUTTON (button), icon);
|
||||
if (g_object_get_data (G_OBJECT (download), "open-download"))
|
||||
gtk_button_clicked (GTK_BUTTON (button));
|
||||
|
||||
if (katze_object_get_boolean (settings, "notify-transfer-completed"))
|
||||
if (1)
|
||||
{
|
||||
const gchar* uri = webkit_download_get_destination_uri (download);
|
||||
gchar* path = soup_uri_decode (uri);
|
||||
|
|
Loading…
Reference in a new issue