Actually require http(s):// in bookmark address

This commit is contained in:
Christian Dywan 2009-09-21 23:53:01 +02:00
parent d26113fa1e
commit b3817bfc52

View file

@ -605,24 +605,14 @@ midori_view_notify_statusbar_text_cb (MidoriView* view,
} }
} }
static gboolean static void
midori_browser_edit_bookmark_uri_focus_in_cb (GtkEntry* entry, midori_browser_edit_bookmark_uri_changed_cb (GtkEntry* entry,
GdkEventFocus* event, GtkDialog* dialog)
GtkDialog* dialog)
{
gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, TRUE);
return FALSE;
}
static gboolean
midori_browser_edit_bookmark_uri_focus_out_cb (GtkEntry* entry,
GdkEventFocus* event,
GtkDialog* dialog)
{ {
const gchar* uri = gtk_entry_get_text (entry); const gchar* uri = gtk_entry_get_text (entry);
gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT,
uri && g_strstr_len (uri, -1, "://")); uri && g_str_has_prefix (uri, "http://")
return FALSE; || g_str_has_prefix (uri, "https://"));
} }
/* Private function, used by MidoriBookmarks and MidoriHistory */ /* Private function, used by MidoriBookmarks and MidoriHistory */
@ -718,10 +708,10 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
entry_uri = gtk_entry_new (); entry_uri = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (entry_uri), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (entry_uri), TRUE);
gtk_entry_set_text (GTK_ENTRY (entry_uri), katze_item_get_uri (bookmark)); gtk_entry_set_text (GTK_ENTRY (entry_uri), katze_item_get_uri (bookmark));
g_signal_connect (entry_uri, "focus-in-event", midori_browser_edit_bookmark_uri_changed_cb (GTK_ENTRY (entry_uri),
G_CALLBACK (midori_browser_edit_bookmark_uri_focus_in_cb), dialog); GTK_DIALOG (dialog));
g_signal_connect (entry_uri, "focus-out-event", g_signal_connect (entry_uri, "changed",
G_CALLBACK (midori_browser_edit_bookmark_uri_focus_out_cb), dialog); G_CALLBACK (midori_browser_edit_bookmark_uri_changed_cb), dialog);
gtk_box_pack_start (GTK_BOX (hbox), entry_uri, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), entry_uri, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);