diff options
Diffstat (limited to 'src/selmgr.c')
-rw-r--r-- | src/selmgr.c | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/src/selmgr.c b/src/selmgr.c index 7ac4a95..490163d 100644 --- a/src/selmgr.c +++ b/src/selmgr.c @@ -69,7 +69,7 @@ setup_x(const gchar *display) xcb_flush(conn); } -void +static void expose_stop(xcb_timestamp_t time) { security_context_t octx; @@ -121,7 +121,7 @@ expose_item_matches(GtkTreeIter *iter, xcb_atom_t name, security_context_t ctx) return result; } -void +static void expose(xcb_atom_t name, xcb_window_t owner, security_context_t level, xcb_timestamp_t time) { @@ -479,3 +479,55 @@ sel_manager_init(struct thread_data *data) return 0; } + +void +sel_expose(GtkWidget *widget, GtkTreeView *view) +{ + GtkTreeSelection *sel; + GtkTreeIter iter; + GtkWidget *dialog; + xcb_atom_t atom; + xcb_window_t owner; + gchar *name, *octx; + + sel = gtk_tree_view_get_selection(view); + + if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(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); + } +} + +void +sel_expose_stop(GtkDialog *dialog, gint response_id, gpointer user_data) +{ + gtk_widget_hide_all(expwin); + expose_stop(timestamp); +} |