diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 62 |
1 files changed, 5 insertions, 57 deletions
@@ -11,7 +11,8 @@ static GtkWidget *appwin; static GtkWidget *expwin; static GtkListStore *sel_store; static GtkTreeStore *prop_store, *dev_store; -static unsigned timestamp; +static GtkTreeView *sel_view; +unsigned timestamp; static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) @@ -41,58 +42,6 @@ event_register(GObject *obj) g_signal_connect(obj, "button-release-event", G_CALLBACK(event), NULL); } -static void -start(GtkWidget *widget, GtkTreeView *tree) -{ - GtkTreeSelection *sel; - GtkTreeIter iter; - GtkWidget *dialog; - xcb_atom_t atom; - xcb_window_t owner; - gchar *name, *octx; - - sel = gtk_tree_view_get_selection(tree); - - if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { - gtk_tree_model_get(GTK_TREE_MODEL(sel_store), &iter, - COL_ATOM, &atom, COL_WIN, &owner, - COL_NAME, &name, COL_OCTX, &octx, - -1); - - dialog = gtk_message_dialog_new(GTK_WINDOW(appwin), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "Really make clipboard %s,\n" - "at level %s\n" - "available to all levels?", - name, octx); - - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES) - expose(atom, owner, octx, timestamp); - - gtk_widget_destroy(dialog); - g_free(name); - g_free(octx); - } - else { - dialog = gtk_message_dialog_new(GTK_WINDOW(appwin), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - "No clipboard is currently selected."); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - } -} - -static void -stop(GtkDialog *dialog, gint response_id, gpointer user_data) -{ - gtk_widget_hide_all(expwin); - expose_stop(timestamp); -} - static GtkWidget * create_sel_widget(void) { @@ -152,6 +101,7 @@ create_sel_widget(void) gtk_tree_view_append_column(tree, column); sel_store = store; + sel_view = tree; return GTK_WIDGET(tree); } @@ -324,7 +274,7 @@ create_dialogs(void) box = gtk_dialog_get_content_area(GTK_DIALOG(expwin)); gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0); - g_signal_connect(G_OBJECT(expwin), "response", G_CALLBACK(stop), NULL); + g_signal_connect(G_OBJECT(expwin), "response", G_CALLBACK(sel_expose_stop), NULL); } @@ -346,17 +296,15 @@ create_menu(void) gtk_menu_shell_append(GTK_MENU_SHELL(bar), item); /* Action menu */ -/* menu = gtk_menu_new(); item = gtk_image_menu_item_new_from_stock(GTK_STOCK_COPY, NULL); event_register(G_OBJECT(item)); - g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(start), selw); + g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(sel_expose), sel_view); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); item = gtk_menu_item_new_with_mnemonic("_Action"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); gtk_menu_shell_append(GTK_MENU_SHELL(bar), item); -*/ return bar; } |