2 Copyright (C) 2010-2011 wpitchoune@gmail.com
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 on_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
27 #if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
28 gtk_widget_hide(((struct ui_psensor *)data)->main_window);
36 void ui_psensor_exit()
41 GtkWidget *ui_window_create(struct ui_psensor * ui)
43 GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
45 GdkColormap *colormap;
47 GtkIconTheme *icon_theme;
49 gtk_window_set_default_size(GTK_WINDOW(window), 800, 200);
51 gtk_window_set_title(GTK_WINDOW(window),
52 _("Psensor - Temperature Monitor"));
53 gtk_window_set_role(GTK_WINDOW(window), "psensor");
55 screen = gtk_widget_get_screen(window);
57 if (ui->config->alpha_channel_enabled
58 && gdk_screen_is_composited(screen)) {
60 colormap = gdk_screen_get_rgba_colormap(screen);
62 gtk_widget_set_colormap(window, colormap);
64 ui->config->alpha_channel_enabled = 0;
66 ui->config->alpha_channel_enabled = 0;
69 icon_theme = gtk_icon_theme_get_default();
70 icon = gtk_icon_theme_load_icon(icon_theme, "psensor", 48, 0, NULL);
72 gtk_window_set_icon(GTK_WINDOW(window), icon);
74 fprintf(stderr, _("ERROR: Failed to load psensor icon.\n"));
76 g_signal_connect(window,
77 "delete_event", G_CALLBACK(on_delete_event_cb), ui);
79 gtk_window_set_decorated(GTK_WINDOW(window),
80 ui->config->window_decoration_enabled);
82 gtk_window_set_keep_below(GTK_WINDOW(window),
83 ui->config->window_keep_below_enabled);