GTK+2 panel 

GTK+2 panel Git Source Tree

Root/callbacks.c

1#include "config.h"
2#include "callbacks.h"
3
4#define WNCK_I_KNOW_THIS_IS_UNSTABLE 1
5#include <libwnck/libwnck.h>
6
7
8void
9gp_logout (void)
10{
11 GtkWidget *dialog;
12 GtkResponseType response;
13
14 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
15 GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
16 "Are you sure you want to quit?");
17 gtk_window_set_title (GTK_WINDOW (dialog), PACKAGE_STRING);
18 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
19 response = gtk_dialog_run (GTK_DIALOG (dialog));
20 gtk_widget_destroy (dialog);
21
22 if (response == GTK_RESPONSE_YES)
23 gtk_main_quit ();
24}
25
26void
27gp_showdesktop_toggled (GtkToggleButton *toggler)
28{
29 WnckScreen *screen;
30 gboolean to_hide;
31
32 g_return_if_fail (GTK_IS_WIDGET (toggler));
33
34 screen = wnck_screen_get_default ();
35 wnck_screen_force_update (screen);
36 g_object_get (toggler, "active", &to_hide, NULL);
37
38 /* TODO: make a per-desktop flag (and update the toggle button state) */
39 wnck_screen_toggle_showing_desktop (screen, to_hide);
40}
41
42void
43gp_spawn (GtkWidget *widget)
44{
45 const gchar *application;
46 GError *error;
47
48 g_return_if_fail (GTK_IS_WIDGET (widget));
49
50 application = gtk_widget_get_name (widget);
51 g_return_if_fail (application != NULL);
52
53 error = NULL;
54 if (!g_spawn_command_line_async (application, &error))
55 {
56 GtkWidget *dialog;
57 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
58 GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
59 "Unable to spawn '%s':\n%s",
60 application, error->message);
61 gtk_window_set_title (GTK_WINDOW (dialog), PACKAGE_STRING);
62 gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
63 gtk_dialog_run (GTK_DIALOG (dialog));
64 gtk_widget_destroy (dialog);
65 }
66}

Archive Download this file

Branches

Tags