Implement 'Edit' in adblock to activate the cell in the list
This commit is contained in:
parent
7bfd4e147d
commit
f14b711901
1 changed files with 23 additions and 1 deletions
|
@ -306,6 +306,26 @@ adblock_preferences_add_clicked_cb (GtkWidget* button,
|
||||||
gtk_entry_set_text (entry, "");
|
gtk_entry_set_text (entry, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
adblock_preferences_edit_clicked_cb (GtkWidget* button,
|
||||||
|
GtkTreeViewColumn* column)
|
||||||
|
{
|
||||||
|
GdkEvent* event = gtk_get_current_event ();
|
||||||
|
GtkTreeView* treeview = g_object_get_data (G_OBJECT (button), "treeview");
|
||||||
|
GtkTreeModel* model;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
if (katze_tree_view_get_selected_iter (treeview, &model, &iter))
|
||||||
|
{
|
||||||
|
gchar* path = gtk_tree_model_get_string_from_iter (model, &iter);
|
||||||
|
GtkTreePath* tree_path = gtk_tree_path_new_from_string (path);
|
||||||
|
/* gtk_cell_renderer_start_editing */
|
||||||
|
gtk_tree_view_set_cursor (treeview, tree_path, column, TRUE);
|
||||||
|
gtk_tree_path_free (tree_path);
|
||||||
|
g_free (path);
|
||||||
|
}
|
||||||
|
gdk_event_free (event);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
adblock_preferences_remove_clicked_cb (GtkWidget* button,
|
adblock_preferences_remove_clicked_cb (GtkWidget* button,
|
||||||
GtkTreeView* treeview)
|
GtkTreeView* treeview)
|
||||||
|
@ -458,8 +478,10 @@ adblock_get_preferences_dialog (MidoriExtension* extension)
|
||||||
G_CALLBACK (adblock_preferences_add_clicked_cb), liststore);
|
G_CALLBACK (adblock_preferences_add_clicked_cb), liststore);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||||
button = gtk_button_new_from_stock (GTK_STOCK_EDIT);
|
button = gtk_button_new_from_stock (GTK_STOCK_EDIT);
|
||||||
|
g_object_set_data (G_OBJECT (button), "treeview", treeview);
|
||||||
|
g_signal_connect (button, "clicked",
|
||||||
|
G_CALLBACK (adblock_preferences_edit_clicked_cb), column);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||||
gtk_widget_set_sensitive (button, FALSE);
|
|
||||||
button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
|
button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
G_CALLBACK (adblock_preferences_remove_clicked_cb), treeview);
|
G_CALLBACK (adblock_preferences_remove_clicked_cb), treeview);
|
||||||
|
|
Loading…
Reference in a new issue