Change browser_save_uri to clear up variable initialization

This commit is contained in:
Christian Dywan 2012-07-19 21:01:43 +02:00
parent 218a6d0b2e
commit 27f5cbfb25

View file

@ -1104,7 +1104,7 @@ midori_browser_save_uri (MidoriBrowser* browser,
GtkWidget* dialog; GtkWidget* dialog;
const gchar* title = midori_view_get_display_title (view); const gchar* title = midori_view_get_display_title (view);
gchar* filename; gchar* filename;
gboolean file_only; gboolean file_only = TRUE;
GtkWidget* checkbox; GtkWidget* checkbox;
if (!gtk_widget_get_visible (GTK_WIDGET (browser))) if (!gtk_widget_get_visible (GTK_WIDGET (browser)))
@ -1120,8 +1120,6 @@ midori_browser_save_uri (MidoriBrowser* browser,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), checkbox); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), checkbox);
} }
else
file_only = TRUE;
if (last_dir && *last_dir) if (last_dir && *last_dir)
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), last_dir); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), last_dir);
else else
@ -1143,7 +1141,7 @@ midori_browser_save_uri (MidoriBrowser* browser,
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
{ {
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
file_only = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)); file_only = !file_only && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
if (!file_only && !g_str_equal (title, uri)) if (!file_only && !g_str_equal (title, uri))
{ {
gchar* fullname = g_strconcat (filename, ".html", NULL); gchar* fullname = g_strconcat (filename, ".html", NULL);