File: | rc/gui.c |
Location: | line 2315, column 2 |
Description: | Value stored to 'vbox' is never read |
1 | /* GKrellM |
2 | | Copyright (C) 1999-2010 Bill Wilson |
3 | | |
4 | | Author: Bill Wilson billw@gkrellm.net |
5 | | Latest versions might be found at: http://gkrellm.net |
6 | | |
7 | | |
8 | | GKrellM is free software: you can redistribute it and/or modify it |
9 | | under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | GKrellM is distributed in the hope that it will be useful, but WITHOUT |
14 | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
15 | | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
16 | | License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see http://www.gnu.org/licenses/ |
20 | | |
21 | | |
22 | | Additional permission under GNU GPL version 3 section 7 |
23 | | |
24 | | If you modify this program, or any covered work, by linking or |
25 | | combining it with the OpenSSL project's OpenSSL library (or a |
26 | | modified version of that library), containing parts covered by |
27 | | the terms of the OpenSSL or SSLeay licenses, you are granted |
28 | | additional permission to convey the resulting work. |
29 | | Corresponding Source for a non-source form of such a combination |
30 | | shall include the source code for the parts of OpenSSL used as well |
31 | | as that of the covered work. |
32 | */ |
33 | |
34 | #include "gkrellm.h" |
35 | #include "gkrellm-private.h" |
36 | |
37 | |
38 | GtkWidget *config_window; |
39 | |
40 | |
41 | void |
42 | gkrellm_message_dialog(gchar *title, gchar *message) |
43 | { |
44 | GtkWidget *top_win; |
45 | GtkWidget *dialog; |
46 | GtkWidget *scrolled; |
47 | GtkWidget *vbox, *vbox1; |
48 | GtkWidget *label; |
49 | gchar *s; |
50 | gint nlines; |
51 | |
52 | if (!message) |
53 | return; |
54 | top_win = gkrellm_get_top_window(); |
55 | dialog = gtk_dialog_new_with_buttons(title ? title : "GKrellM", |
56 | GTK_WINDOW(top_win)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (top_win)), ((gtk_window_get_type ())))))), |
57 | GTK_DIALOG_DESTROY_WITH_PARENT, |
58 | GTK_STOCK_OK"gtk-ok", GTK_RESPONSE_NONE, |
59 | NULL((void*)0)); |
60 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response",g_signal_connect_data ((((((GtkObject*) g_type_check_instance_cast ((GTypeInstance*) ((dialog)), ((gtk_object_get_type ())))))) ), ("response"), (((GCallback) (gtk_widget_destroy))), (((((GtkObject *) g_type_check_instance_cast ((GTypeInstance*) ((dialog)), ( (gtk_object_get_type ()))))))), ((void*)0), G_CONNECT_SWAPPED ) |
61 | G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog))g_signal_connect_data ((((((GtkObject*) g_type_check_instance_cast ((GTypeInstance*) ((dialog)), ((gtk_object_get_type ())))))) ), ("response"), (((GCallback) (gtk_widget_destroy))), (((((GtkObject *) g_type_check_instance_cast ((GTypeInstance*) ((dialog)), ( (gtk_object_get_type ()))))))), ((void*)0), G_CONNECT_SWAPPED ); |
62 | gtk_window_set_wmclass(GTK_WINDOW(dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (dialog)), ((gtk_window_get_type ())))))), |
63 | "Gkrellm_dialog", "Gkrellm"); |
64 | |
65 | vbox = gtk_vbox_new(FALSE(0), 0); |
66 | gtk_container_set_border_width(GTK_CONTAINER(vbox)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((gtk_container_get_type ())))))), 8); |
67 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((( (((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) ( (dialog)), ((gtk_dialog_get_type ()))))))->vbox)), ((gtk_box_get_type ())))))), vbox, |
68 | FALSE(0), FALSE(0), 0); |
69 | |
70 | label = gtk_label_new(message); |
71 | gtk_label_set_justify(GTK_LABEL(label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (label)), ((gtk_label_get_type ())))))), GTK_JUSTIFY_LEFT); |
72 | |
73 | for (nlines = 0, s = message; *s; ++s) |
74 | if (*s == '\n') |
75 | ++nlines; |
76 | if (nlines > 20) |
77 | { |
78 | vbox1 = gkrellm_gtk_scrolled_vbox(vbox, &scrolled, |
79 | GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
80 | gtk_widget_set_size_request(scrolled, -1, 300); |
81 | gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1 )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
82 | } |
83 | else |
84 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
85 | |
86 | gtk_widget_show_all(dialog); |
87 | } |
88 | |
89 | void |
90 | gkrellm_config_message_dialog(gchar *title, gchar *message) |
91 | { |
92 | GtkWidget *dialog; |
93 | GtkWidget *vbox; |
94 | GtkWidget *label; |
95 | |
96 | if (!message || !config_window) |
97 | return; |
98 | dialog = gtk_dialog_new_with_buttons(title ? title : "GKrellM", |
99 | GTK_WINDOW(config_window)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (config_window)), ((gtk_window_get_type ())))))), |
100 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, |
101 | GTK_STOCK_OK"gtk-ok", GTK_RESPONSE_OK, |
102 | NULL((void*)0)); |
103 | gtk_window_set_wmclass(GTK_WINDOW(dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (dialog)), ((gtk_window_get_type ())))))), |
104 | "Gkrellm_dialog", "Gkrellm"); |
105 | vbox = gtk_vbox_new(FALSE(0), 0); |
106 | gtk_container_set_border_width(GTK_CONTAINER(vbox)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((gtk_container_get_type ())))))), 8); |
107 | gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((( (((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) ( (dialog)), ((gtk_dialog_get_type ()))))))->vbox)), ((gtk_box_get_type ())))))), vbox, |
108 | FALSE(0), FALSE(0), 0); |
109 | |
110 | label = gtk_label_new(message); |
111 | gtk_label_set_justify(GTK_LABEL(label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (label)), ((gtk_label_get_type ())))))), GTK_JUSTIFY_LEFT); |
112 | |
113 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
114 | |
115 | gtk_widget_show_all(vbox); |
116 | gtk_dialog_run(GTK_DIALOG(dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) ( (dialog)), ((gtk_dialog_get_type ()))))))); |
117 | gtk_widget_destroy(dialog); |
118 | } |
119 | |
120 | #undef gkrellm_message_window |
121 | #undef gkrellm_config_message_window |
122 | |
123 | void |
124 | gkrellm_message_window(gchar *title, gchar *message, GtkWidget *widget) |
125 | { |
126 | gkrellm_message_dialog(title, message); |
127 | } |
128 | |
129 | void |
130 | gkrellm_config_message_window(gchar *title, gchar *message, GtkWidget *widget) |
131 | { |
132 | gkrellm_config_message_dialog(title, message); |
133 | } |
134 | |
135 | static void |
136 | text_view_append(GtkWidget *view, gchar *s) |
137 | { |
138 | GtkTextIter iter; |
139 | GtkTextBuffer *buffer; |
140 | |
141 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)((((GtkTextView*) g_type_check_instance_cast ((GTypeInstance* ) ((view)), ((gtk_text_view_get_type ()))))))); |
142 | gtk_text_buffer_get_end_iter(buffer, &iter); |
143 | // gtk_text_iter_forward_to_end(&iter); |
144 | |
145 | if (strncmp(s, "<b>", 3)(__extension__ (__builtin_constant_p (3) && ((__builtin_constant_p (s) && strlen (s) < ((size_t) (3))) || (__builtin_constant_p ("<b>") && strlen ("<b>") < ((size_t) (3)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (s) && __builtin_constant_p ("<b>") && (__s1_len = strlen (s), __s2_len = strlen ("<b>"), (!( (size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("<b>") + 1) - (size_t)(const void *)("<b>") == 1 ) || __s2_len >= 4)) ? __builtin_strcmp (s, "<b>") : (__builtin_constant_p (s) && ((size_t)(const void *) ((s) + 1) - (size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p ("<b>" ) && ((size_t)(const void *)(("<b>") + 1) - (size_t )(const void *)("<b>") == 1) ? __builtin_strcmp (s, "<b>" ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("<b>"); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("<b>") && ((size_t)(const void *)(("<b>" ) + 1) - (size_t)(const void *)("<b>") == 1) && (__s2_len = strlen ("<b>"), __s2_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (s, "<b>") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) ("<b>"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<b>"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<b>"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("<b>"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (s, "<b>")))); }) : strncmp (s, "<b>", 3))) == 0) |
146 | gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, |
147 | s + 3, -1, "bold", NULL((void*)0)); |
148 | else if (strncmp(s, "<i>", 3)(__extension__ (__builtin_constant_p (3) && ((__builtin_constant_p (s) && strlen (s) < ((size_t) (3))) || (__builtin_constant_p ("<i>") && strlen ("<i>") < ((size_t) (3)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (s) && __builtin_constant_p ("<i>") && (__s1_len = strlen (s), __s2_len = strlen ("<i>"), (!( (size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("<i>") + 1) - (size_t)(const void *)("<i>") == 1 ) || __s2_len >= 4)) ? __builtin_strcmp (s, "<i>") : (__builtin_constant_p (s) && ((size_t)(const void *) ((s) + 1) - (size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p ("<i>" ) && ((size_t)(const void *)(("<i>") + 1) - (size_t )(const void *)("<i>") == 1) ? __builtin_strcmp (s, "<i>" ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("<i>"); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("<i>") && ((size_t)(const void *)(("<i>" ) + 1) - (size_t)(const void *)("<i>") == 1) && (__s2_len = strlen ("<i>"), __s2_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (s, "<i>") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) ("<i>"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<i>"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<i>"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("<i>"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (s, "<i>")))); }) : strncmp (s, "<i>", 3))) == 0) |
149 | gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, |
150 | s + 3, -1, "italic", NULL((void*)0)); |
151 | else if (strncmp(s, "<h>", 3)(__extension__ (__builtin_constant_p (3) && ((__builtin_constant_p (s) && strlen (s) < ((size_t) (3))) || (__builtin_constant_p ("<h>") && strlen ("<h>") < ((size_t) (3)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (s) && __builtin_constant_p ("<h>") && (__s1_len = strlen (s), __s2_len = strlen ("<h>"), (!( (size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("<h>") + 1) - (size_t)(const void *)("<h>") == 1 ) || __s2_len >= 4)) ? __builtin_strcmp (s, "<h>") : (__builtin_constant_p (s) && ((size_t)(const void *) ((s) + 1) - (size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p ("<h>" ) && ((size_t)(const void *)(("<h>") + 1) - (size_t )(const void *)("<h>") == 1) ? __builtin_strcmp (s, "<h>" ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("<h>"); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("<h>") && ((size_t)(const void *)(("<h>" ) + 1) - (size_t)(const void *)("<h>") == 1) && (__s2_len = strlen ("<h>"), __s2_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (s, "<h>") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) ("<h>"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<h>"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<h>"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("<h>"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (s, "<h>")))); }) : strncmp (s, "<h>", 3))) == 0) |
152 | gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, |
153 | s + 3, -1, "heading", NULL((void*)0)); |
154 | else if (strncmp(s, "<c>", 3)(__extension__ (__builtin_constant_p (3) && ((__builtin_constant_p (s) && strlen (s) < ((size_t) (3))) || (__builtin_constant_p ("<c>") && strlen ("<c>") < ((size_t) (3)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (s) && __builtin_constant_p ("<c>") && (__s1_len = strlen (s), __s2_len = strlen ("<c>"), (!( (size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("<c>") + 1) - (size_t)(const void *)("<c>") == 1 ) || __s2_len >= 4)) ? __builtin_strcmp (s, "<c>") : (__builtin_constant_p (s) && ((size_t)(const void *) ((s) + 1) - (size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p ("<c>" ) && ((size_t)(const void *)(("<c>") + 1) - (size_t )(const void *)("<c>") == 1) ? __builtin_strcmp (s, "<c>" ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("<c>"); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("<c>") && ((size_t)(const void *)(("<c>" ) + 1) - (size_t)(const void *)("<c>") == 1) && (__s2_len = strlen ("<c>"), __s2_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (s, "<c>") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) ("<c>"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<c>"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<c>"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("<c>"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (s, "<c>")))); }) : strncmp (s, "<c>", 3))) == 0) |
155 | gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, |
156 | s + 3, -1, "center", NULL((void*)0)); |
157 | else if (strncmp(s, "<ul>", 4)(__extension__ (__builtin_constant_p (4) && ((__builtin_constant_p (s) && strlen (s) < ((size_t) (4))) || (__builtin_constant_p ("<ul>") && strlen ("<ul>") < ((size_t ) (4)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (s) && __builtin_constant_p ("<ul>") && (__s1_len = strlen (s), __s2_len = strlen ("<ul>"), (! ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("<ul>") + 1) - (size_t)(const void *)("<ul>") == 1) || __s2_len >= 4)) ? __builtin_strcmp (s, "<ul>" ) : (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p ("<ul>" ) && ((size_t)(const void *)(("<ul>") + 1) - (size_t )(const void *)("<ul>") == 1) ? __builtin_strcmp (s, "<ul>" ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("<ul>"); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("<ul>") && ((size_t)(const void *)(("<ul>" ) + 1) - (size_t)(const void *)("<ul>") == 1) && (__s2_len = strlen ("<ul>"), __s2_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (s, "<ul>") : (- ( __extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) ("<ul>"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<ul>"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("<ul>"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("<ul>"))[3] - __s2[3]); } } __result ; })))) : __builtin_strcmp (s, "<ul>")))); }) : strncmp (s, "<ul>", 4))) == 0) |
158 | gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, |
159 | s + 4, -1, "underline", NULL((void*)0)); |
160 | else |
161 | gtk_text_buffer_insert(buffer, &iter, s, -1); |
162 | } |
163 | |
164 | void |
165 | gkrellm_gtk_text_view_append(GtkWidget *view, gchar *string) |
166 | { |
167 | static gchar *tag; |
168 | gchar *s; |
169 | |
170 | s = string; |
171 | if ( *s == '<' |
172 | && ( (*(s + 2) == '>' && !*(s + 3)) |
173 | || (*(s + 3) == '>' && !*(s + 4)) |
174 | ) |
175 | ) |
176 | { |
177 | tag = g_strdup(s); |
178 | return; |
179 | } |
180 | if (tag) |
181 | { |
182 | s = g_strconcat(tag, string, NULL((void*)0)); |
183 | text_view_append(view, s); |
184 | g_free(s); |
185 | g_free(tag); |
186 | tag = NULL((void*)0); |
187 | } |
188 | else |
189 | text_view_append(view, string); |
190 | } |
191 | |
192 | void |
193 | gkrellm_gtk_text_view_append_strings(GtkWidget *view, gchar **string, |
194 | gint n_strings) |
195 | { |
196 | gchar *tag = NULL((void*)0); |
197 | gchar *s, *t; |
198 | gint i; |
199 | |
200 | for (i = 0; i < n_strings; ++i) |
201 | { |
202 | s = string[i]; |
203 | if ( *s == '<' |
204 | && ( (*(s + 2) == '>' && !*(s + 3)) |
205 | || (*(s + 3) == '>' && !*(s + 4)) |
206 | ) |
207 | ) |
208 | { |
209 | tag = g_strdup(s); |
210 | continue; |
211 | } |
212 | #if defined(ENABLE_NLS1) |
213 | s = gettext(string[i])dcgettext (((void*)0), string[i], 5); |
214 | #else |
215 | s = string[i]; |
216 | #endif |
217 | if (tag) |
218 | { |
219 | t = g_strconcat(tag, s, NULL((void*)0)); |
220 | text_view_append(view, t); |
221 | g_free(t); |
222 | g_free(tag); |
223 | tag = NULL((void*)0); |
224 | } |
225 | else |
226 | text_view_append(view, s); |
227 | } |
228 | } |
229 | |
230 | GtkWidget * |
231 | gkrellm_gtk_scrolled_text_view(GtkWidget *box, GtkWidget **scr, |
232 | GtkPolicyType h_policy, GtkPolicyType v_policy) |
233 | { |
234 | GtkWidget *scrolled, |
235 | *view; |
236 | GtkTextBuffer *buffer; |
237 | |
238 | scrolled = gtk_scrolled_window_new(NULL((void*)0), NULL((void*)0)); |
239 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled)((((GtkScrolledWindow*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_scrolled_window_get_type ())))))), |
240 | h_policy, v_policy); |
241 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), scrolled, TRUE(!(0)), TRUE(!(0)), 0); |
242 | |
243 | view = gtk_text_view_new(); |
244 | gtk_text_view_set_editable(GTK_TEXT_VIEW(view)((((GtkTextView*) g_type_check_instance_cast ((GTypeInstance* ) ((view)), ((gtk_text_view_get_type ())))))), FALSE(0)); |
245 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)((((GtkTextView*) g_type_check_instance_cast ((GTypeInstance* ) ((view)), ((gtk_text_view_get_type ()))))))); |
246 | gtk_container_add(GTK_CONTAINER(scrolled)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_container_get_type ())))))), view); |
247 | gtk_text_buffer_create_tag(buffer, "heading", |
248 | "weight", PANGO_WEIGHT_BOLD, |
249 | "size", 14 * PANGO_SCALE1024, NULL((void*)0)); |
250 | gtk_text_buffer_create_tag(buffer, "italic", |
251 | "style", PANGO_STYLE_ITALIC, NULL((void*)0)); |
252 | gtk_text_buffer_create_tag (buffer, "bold", |
253 | "weight", PANGO_WEIGHT_BOLD, NULL((void*)0)); |
254 | gtk_text_buffer_create_tag (buffer, "center", |
255 | "justification", GTK_JUSTIFY_CENTER, NULL((void*)0)); |
256 | gtk_text_buffer_create_tag (buffer, "underline", |
257 | "underline", PANGO_UNDERLINE_SINGLE, NULL((void*)0)); |
258 | if (scr) |
259 | *scr = scrolled; |
260 | return view; |
261 | } |
262 | |
263 | GtkTreeSelection * |
264 | gkrellm_gtk_scrolled_selection(GtkTreeView *treeview, GtkWidget *box, |
265 | GtkSelectionMode s_mode, |
266 | GtkPolicyType h_policy, GtkPolicyType v_policy, |
267 | void (*func_cb)(), gpointer data) |
268 | { |
269 | GtkTreeSelection *selection; |
270 | GtkWidget *scrolled; |
271 | |
272 | if (!box || !treeview) |
273 | return NULL((void*)0); |
274 | |
275 | scrolled = gtk_scrolled_window_new(NULL((void*)0), NULL((void*)0)); |
276 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), scrolled, TRUE(!(0)), TRUE(!(0)), 0); |
277 | gtk_container_add(GTK_CONTAINER(scrolled)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_container_get_type ())))))), GTK_WIDGET(treeview)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (treeview)), ((gtk_widget_get_type ()))))))); |
278 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled)((((GtkScrolledWindow*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_scrolled_window_get_type ())))))), |
279 | h_policy, v_policy); |
280 | selection = gtk_tree_view_get_selection(treeview); |
281 | gtk_tree_selection_set_mode(selection, s_mode); |
282 | if (func_cb) |
283 | g_signal_connect(G_OBJECT(selection), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((selection)), (((GType) ((20) << (2 ))))))))), ("changed"), (((GCallback) (func_cb))), (data), (( void*)0), (GConnectFlags) 0) |
284 | G_CALLBACK(func_cb), data)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((selection)), (((GType) ((20) << (2 ))))))))), ("changed"), (((GCallback) (func_cb))), (data), (( void*)0), (GConnectFlags) 0); |
285 | return selection; |
286 | } |
287 | |
288 | void |
289 | gkrellm_launch_button_cb(GkrellmDecalbutton *button) |
290 | { |
291 | GkrellmLauncher *launch; |
292 | |
293 | launch = (GkrellmLauncher *) button->data; |
294 | g_spawn_command_line_async(launch->command, NULL((void*)0) /* GError */); |
295 | } |
296 | |
297 | void |
298 | gkrellm_remove_launcher(GkrellmLauncher *launch) |
299 | { |
300 | if (launch->button) |
301 | gkrellm_destroy_button(launch->button); |
302 | launch->button = NULL((void*)0); |
303 | } |
304 | |
305 | void |
306 | gkrellm_configure_tooltip(GkrellmPanel *p, GkrellmLauncher *launch) |
307 | { |
308 | launch->widget = p->drawing_area; |
309 | if (*launch->tooltip_comment && *launch->command) |
310 | { |
311 | gtk_widget_set_tooltip_text(p->drawing_area, |
312 | launch->tooltip_comment); |
313 | } |
314 | else |
315 | gtk_widget_set_tooltip_text(p->drawing_area, |
316 | NULL((void*)0)); |
317 | } |
318 | |
319 | void |
320 | gkrellm_apply_launcher(GtkWidget **launch_entry, GtkWidget **tooltip_entry, |
321 | GkrellmPanel *p, GkrellmLauncher *launch, void (*func)()) |
322 | { |
323 | gchar *command, *tip_comment; |
324 | |
325 | if (!launch_entry || !launch || !p) |
326 | return; |
327 | command = gkrellm_gtk_entry_get_text(launch_entry); |
328 | tip_comment = tooltip_entry ? |
329 | gkrellm_gtk_entry_get_text(tooltip_entry) : ""; |
330 | if ( launch->command && !strcmp(command, launch->command)__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (command) && __builtin_constant_p (launch->command ) && (__s1_len = strlen (command), __s2_len = strlen ( launch->command), (!((size_t)(const void *)((command) + 1) - (size_t)(const void *)(command) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((launch->command) + 1 ) - (size_t)(const void *)(launch->command) == 1) || __s2_len >= 4)) ? __builtin_strcmp (command, launch->command) : (__builtin_constant_p (command) && ((size_t)(const void *)((command) + 1) - (size_t)(const void *)(command) == 1) && (__s1_len = strlen (command), __s1_len < 4) ? (__builtin_constant_p (launch->command) && ((size_t)(const void *)((launch ->command) + 1) - (size_t)(const void *)(launch->command ) == 1) ? __builtin_strcmp (command, launch->command) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (launch->command); int __result = (((const unsigned char *) (const char *) (command))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (command))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (command))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (command))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p (launch->command) && ((size_t)(const void *)((launch->command) + 1) - (size_t) (const void *)(launch->command) == 1) && (__s2_len = strlen (launch->command), __s2_len < 4) ? (__builtin_constant_p (command) && ((size_t)(const void *)((command) + 1) - (size_t)(const void *)(command) == 1) ? __builtin_strcmp (command , launch->command) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (command); int __result = (((const unsigned char *) (const char *) (launch-> command))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( launch->command))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (launch->command))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (launch->command))[3] - __s2[3]); } } __result ; })))) : __builtin_strcmp (command, launch->command)))); } ) |
331 | && launch->tooltip_comment |
332 | && !strcmp(tip_comment, launch->tooltip_comment)__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (tip_comment) && __builtin_constant_p (launch->tooltip_comment ) && (__s1_len = strlen (tip_comment), __s2_len = strlen (launch->tooltip_comment), (!((size_t)(const void *)((tip_comment ) + 1) - (size_t)(const void *)(tip_comment) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((launch->tooltip_comment ) + 1) - (size_t)(const void *)(launch->tooltip_comment) == 1) || __s2_len >= 4)) ? __builtin_strcmp (tip_comment, launch ->tooltip_comment) : (__builtin_constant_p (tip_comment) && ((size_t)(const void *)((tip_comment) + 1) - (size_t)(const void *)(tip_comment) == 1) && (__s1_len = strlen (tip_comment ), __s1_len < 4) ? (__builtin_constant_p (launch->tooltip_comment ) && ((size_t)(const void *)((launch->tooltip_comment ) + 1) - (size_t)(const void *)(launch->tooltip_comment) == 1) ? __builtin_strcmp (tip_comment, launch->tooltip_comment ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (launch->tooltip_comment); int __result = (((const unsigned char *) (const char *) (tip_comment))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (tip_comment))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (tip_comment))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (tip_comment))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (launch ->tooltip_comment) && ((size_t)(const void *)((launch ->tooltip_comment) + 1) - (size_t)(const void *)(launch-> tooltip_comment) == 1) && (__s2_len = strlen (launch-> tooltip_comment), __s2_len < 4) ? (__builtin_constant_p (tip_comment ) && ((size_t)(const void *)((tip_comment) + 1) - (size_t )(const void *)(tip_comment) == 1) ? __builtin_strcmp (tip_comment , launch->tooltip_comment) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (tip_comment ); int __result = (((const unsigned char *) (const char *) (launch ->tooltip_comment))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (launch->tooltip_comment))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (launch->tooltip_comment))[2] - __s2 [2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (launch->tooltip_comment ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (tip_comment , launch->tooltip_comment)))); }) |
333 | ) |
334 | return; |
335 | if (*command) |
336 | { |
337 | if (!launch->button) |
338 | { |
339 | if (launch->type == METER_LAUNCHER1) |
340 | launch->button = gkrellm_put_label_in_meter_button(p, func, |
341 | launch, launch->pad); |
342 | else if (launch->type == PANEL_LAUNCHER0) |
343 | launch->button = gkrellm_put_label_in_panel_button(p, func, |
344 | launch, launch->pad); |
345 | else if (launch->type == DECAL_LAUNCHER3) |
346 | launch->button = gkrellm_put_decal_in_meter_button(p, |
347 | launch->decal, |
348 | gkrellm_launch_button_cb, launch, &launch->margin); |
349 | } |
350 | gkrellm_dup_string(&launch->command, command); |
351 | } |
352 | else |
353 | { |
354 | if (launch->button) |
355 | gkrellm_destroy_button(launch->button); |
356 | launch->button = NULL((void*)0); |
357 | launch->pipe = NULL((void*)0); /* Close?? */ |
358 | gkrellm_dup_string(&launch->command, ""); |
359 | } |
360 | gkrellm_dup_string(&launch->tooltip_comment, tip_comment); |
361 | gkrellm_configure_tooltip(p, launch); |
362 | } |
363 | |
364 | GtkWidget * |
365 | gkrellm_gtk_launcher_table_new(GtkWidget *vbox, gint n_launchers) |
366 | { |
367 | GtkWidget *table; |
368 | |
369 | table = gtk_table_new(2 * n_launchers, 2, FALSE(0) /*non-homogeneous*/); |
370 | gtk_table_set_col_spacings(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) ( (table)), ((gtk_table_get_type ())))))), 2); |
371 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), table, FALSE(0), FALSE(0), 2); |
372 | return table; |
373 | } |
374 | |
375 | void |
376 | gkrellm_gtk_config_launcher(GtkWidget *table, gint n, GtkWidget **launch_entry, |
377 | GtkWidget **tooltip_entry, gchar *desc, GkrellmLauncher *launch) |
378 | { |
379 | GtkWidget *label, *hbox; |
380 | gchar buf[64]; |
381 | gint row; |
382 | |
383 | if (!table || !launch_entry) |
384 | return; |
385 | row = (tooltip_entry ? 2 : 1) * n; |
386 | hbox = gtk_hbox_new(FALSE(0), 0); |
387 | /* Attach left right top bottom */ |
388 | gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) ( (table)), ((gtk_table_get_type ())))))), hbox, 0, 1, row, row + 1, |
389 | GTK_FILL, GTK_SHRINK, 0, 0); |
390 | |
391 | snprintf(buf, sizeof(buf), _("%s command")dcgettext ("gkrellm", "%s command", 5), desc); |
392 | label = gtk_label_new(buf); |
393 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 1.0, 0.5); |
394 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 4); |
395 | |
396 | *launch_entry = gtk_entry_new(); |
397 | gtk_entry_set_max_length(GTK_ENTRY(*launch_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (*launch_entry)), ((gtk_entry_get_type ())))))), 255); |
398 | gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) ( (table)), ((gtk_table_get_type ())))))), *launch_entry, |
399 | 1, 2, row, row + 1); |
400 | gtk_entry_set_text(GTK_ENTRY(*launch_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (*launch_entry)), ((gtk_entry_get_type ())))))), |
401 | (launch && launch->command) ? launch->command : ""); |
402 | |
403 | if (tooltip_entry) |
404 | { |
405 | hbox = gtk_hbox_new(FALSE(0), 0); |
406 | gtk_table_attach(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) ( (table)), ((gtk_table_get_type ())))))), hbox, 0, 1, row + 1, row + 2, |
407 | GTK_FILL, GTK_SHRINK, 0, 0); |
408 | |
409 | label = gtk_label_new(_("comment")dcgettext ("gkrellm", "comment", 5)); |
410 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 1.0, 0.5); |
411 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 4); |
412 | *tooltip_entry = gtk_entry_new(); |
413 | gtk_entry_set_max_length(GTK_ENTRY(*tooltip_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (*tooltip_entry)), ((gtk_entry_get_type ())))))), 255); |
414 | gtk_table_attach_defaults(GTK_TABLE(table)((((GtkTable*) g_type_check_instance_cast ((GTypeInstance*) ( (table)), ((gtk_table_get_type ())))))), *tooltip_entry, |
415 | 1, 2, row + 1, row + 2); |
416 | gtk_entry_set_text(GTK_ENTRY(*tooltip_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (*tooltip_entry)), ((gtk_entry_get_type ())))))), |
417 | (launch && launch->tooltip_comment) |
418 | ? launch->tooltip_comment : ""); |
419 | } |
420 | } |
421 | |
422 | /* FIXME: this guy is called on panels at create events |
423 | | when this situation has occurred: the GKrellM rebuild has destroyed |
424 | | the decal button list. But existing launchers have not had their |
425 | | button pointer set to NULL! This could cause a problem with |
426 | | code that tries to check for button pointers in the create routines. |
427 | */ |
428 | void |
429 | gkrellm_setup_launcher(GkrellmPanel *p, GkrellmLauncher *launch, |
430 | gint type, gint pad) |
431 | { |
432 | if (!launch) |
433 | return; |
434 | if (!launch->command) |
435 | launch->command = g_strdup(""); |
436 | if (!launch->tooltip_comment) |
437 | launch->tooltip_comment = g_strdup(""); |
438 | launch->type = type; |
439 | launch->pad = pad; |
440 | if (p) |
441 | { |
442 | gkrellm_configure_tooltip(p, launch); |
443 | if (*(launch->command)) |
444 | launch->button = gkrellm_put_label_in_meter_button(p, |
445 | gkrellm_launch_button_cb, launch, launch->pad); |
446 | else |
447 | launch->button = NULL((void*)0); /* In case dangling pointer, see above */ |
448 | } |
449 | } |
450 | |
451 | void |
452 | gkrellm_setup_decal_launcher(GkrellmPanel *p, GkrellmLauncher *launch, |
453 | GkrellmDecal *d) |
454 | { |
455 | if (!launch) |
456 | return; |
457 | if (!launch->command) |
458 | launch->command = g_strdup(""); |
459 | if (!launch->tooltip_comment) |
460 | launch->tooltip_comment = g_strdup(""); |
461 | launch->type = DECAL_LAUNCHER3; |
462 | launch->pad = 0; |
463 | launch->decal = d; |
464 | if (p) |
465 | { |
466 | gkrellm_configure_tooltip(p, launch); |
467 | if (*(launch->command)) |
468 | launch->button = gkrellm_put_decal_in_meter_button(p, d, |
469 | gkrellm_launch_button_cb, launch, &launch->margin); |
470 | else |
471 | launch->button = NULL((void*)0); /* In case dangling pointer, see above */ |
472 | } |
473 | } |
474 | |
475 | void |
476 | gkrellm_gtk_check_button(GtkWidget *box, GtkWidget **button, gboolean active, |
477 | gboolean expand, gint pad, gchar *string) |
478 | { |
479 | GtkWidget *b; |
480 | |
481 | if (!string) |
482 | return; |
483 | b = gtk_check_button_new_with_label(string); |
484 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((b)), ((gtk_toggle_button_get_type ())))))), active); |
485 | if (box) |
486 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), b, expand, FALSE(0), pad); |
487 | if (button) |
488 | *button = b; |
489 | } |
490 | |
491 | void |
492 | gkrellm_gtk_check_button_connected(GtkWidget *box, GtkWidget **button, |
493 | gboolean active, gboolean expand, gboolean fill, gint pad, |
494 | void (*cb_func)(), gpointer data, gchar *string) |
495 | { |
496 | GtkWidget *b; |
497 | |
498 | if (!string) |
499 | return; |
500 | b = gtk_check_button_new_with_label(string); |
501 | |
502 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((b)), ((gtk_toggle_button_get_type ())))))), active); |
503 | if (box) |
504 | { |
505 | if (pad < 0) |
506 | gtk_box_pack_end(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), b, expand, fill, -(pad + 1)); |
507 | else |
508 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), b, expand, fill, pad); |
509 | } |
510 | if (cb_func) |
511 | g_signal_connect(G_OBJECT(b), "toggled",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((b)), (((GType) ((20) << (2)))))))) ), ("toggled"), (((GCallback) (cb_func))), (data), ((void*)0) , (GConnectFlags) 0) |
512 | G_CALLBACK(cb_func), data)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((b)), (((GType) ((20) << (2)))))))) ), ("toggled"), (((GCallback) (cb_func))), (data), ((void*)0) , (GConnectFlags) 0); |
513 | if (button) |
514 | *button = b; |
515 | } |
516 | |
517 | void |
518 | gkrellm_gtk_button_connected(GtkWidget *box, GtkWidget **button, |
519 | gboolean expand, gboolean fill, gint pad, |
520 | void (*cb_func)(), gpointer data, gchar *string) |
521 | { |
522 | GtkWidget *b; |
523 | |
524 | if (!string) |
525 | return; |
526 | if (!strncmp(string, "gtk-", 4)(__extension__ (__builtin_constant_p (4) && ((__builtin_constant_p (string) && strlen (string) < ((size_t) (4))) || ( __builtin_constant_p ("gtk-") && strlen ("gtk-") < ((size_t) (4)))) ? __extension__ ({ size_t __s1_len, __s2_len ; (__builtin_constant_p (string) && __builtin_constant_p ("gtk-") && (__s1_len = strlen (string), __s2_len = strlen ("gtk-"), (!((size_t)(const void *)((string) + 1) - (size_t) (const void *)(string) == 1) || __s1_len >= 4) && ( !((size_t)(const void *)(("gtk-") + 1) - (size_t)(const void * )("gtk-") == 1) || __s2_len >= 4)) ? __builtin_strcmp (string , "gtk-") : (__builtin_constant_p (string) && ((size_t )(const void *)((string) + 1) - (size_t)(const void *)(string ) == 1) && (__s1_len = strlen (string), __s1_len < 4) ? (__builtin_constant_p ("gtk-") && ((size_t)(const void *)(("gtk-") + 1) - (size_t)(const void *)("gtk-") == 1) ? __builtin_strcmp (string, "gtk-") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("gtk-"); int __result = (((const unsigned char *) (const char *) (string))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( string))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( string))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (string ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "gtk-") && ((size_t)(const void *)(("gtk-") + 1) - (size_t )(const void *)("gtk-") == 1) && (__s2_len = strlen ( "gtk-"), __s2_len < 4) ? (__builtin_constant_p (string) && ((size_t)(const void *)((string) + 1) - (size_t)(const void * )(string) == 1) ? __builtin_strcmp (string, "gtk-") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (string); int __result = (((const unsigned char *) ( const char *) ("gtk-"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("gtk-"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("gtk-"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("gtk-"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (string, "gtk-")))); }) : strncmp (string, "gtk-", 4)))) |
527 | b = gtk_button_new_from_stock(string); |
528 | else |
529 | b = gtk_button_new_with_label(string); |
530 | if (box) |
531 | { |
532 | if (pad < 0) |
533 | gtk_box_pack_end(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), b, expand, fill, -(pad + 1)); |
534 | else |
535 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), b, expand, fill, pad); |
536 | } |
537 | if (cb_func) |
538 | g_signal_connect(G_OBJECT(b), "clicked",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((b)), (((GType) ((20) << (2)))))))) ), ("clicked"), (((GCallback) (cb_func))), (data), ((void*)0) , (GConnectFlags) 0) |
539 | G_CALLBACK(cb_func), data)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((b)), (((GType) ((20) << (2)))))))) ), ("clicked"), (((GCallback) (cb_func))), (data), ((void*)0) , (GConnectFlags) 0); |
540 | if (button) |
541 | *button = b; |
542 | } |
543 | |
544 | void |
545 | gkrellm_gtk_alert_button(GtkWidget *box, GtkWidget **button, |
546 | gboolean expand, gboolean fill, gint pad, gboolean pack_start, |
547 | void (*cb_func)(), gpointer data) |
548 | { |
549 | GtkWidget *b, *hbox; |
550 | GtkWidget *image, *label; |
551 | |
552 | hbox = gtk_hbox_new(FALSE(0), 0); |
553 | gtk_container_set_border_width(GTK_CONTAINER(hbox)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((hbox)), ((gtk_container_get_type ())))))), 2); |
554 | image = gtk_image_new_from_pixbuf(gkrellm_alert_pixbuf()); |
555 | label = gtk_label_new(_("Alerts")dcgettext ("gkrellm", "Alerts", 5)); |
556 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), image, FALSE(0), FALSE(0), 3); |
557 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 3); |
558 | b = gtk_button_new(); |
559 | if (button) |
560 | *button = b; |
561 | if (cb_func) |
562 | g_signal_connect(G_OBJECT(b), "clicked", G_CALLBACK(cb_func), data)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((b)), (((GType) ((20) << (2)))))))) ), ("clicked"), (((GCallback) (cb_func))), (data), ((void*)0) , (GConnectFlags) 0); |
563 | gtk_widget_show_all(hbox); |
564 | gtk_container_add(GTK_CONTAINER(b)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((b)), ((gtk_container_get_type ())))))), hbox); |
565 | if (box) |
566 | { |
567 | if (pack_start) |
568 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), b, expand, fill, pad); |
569 | else |
570 | gtk_box_pack_end(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), b, expand, fill, pad); |
571 | } |
572 | } |
573 | |
574 | void |
575 | gkrellm_gtk_spin_button(GtkWidget *box, GtkWidget **spin_button, gfloat value, |
576 | gfloat low, gfloat high, gfloat step0, gfloat step1, |
577 | gint digits, gint width, |
578 | void (*cb_func)(), gpointer data, gboolean right_align, gchar *string) |
579 | { |
580 | GtkWidget *hbox = NULL((void*)0), |
581 | *label, |
582 | *button; |
583 | GtkSpinButton *spin; |
584 | GtkAdjustment *adj; |
585 | |
586 | if (string && box) |
587 | { |
588 | hbox = gtk_hbox_new (FALSE(0), 0); |
589 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 2); |
590 | box = hbox; |
591 | } |
592 | adj = (GtkAdjustment *) gtk_adjustment_new (value, |
593 | low, high, step0, step1, 0.0); |
594 | button = gtk_spin_button_new(adj, 0.5, digits); |
595 | if (spin_button) |
596 | *spin_button = button; |
597 | if (width > 0) |
598 | gtk_widget_set_size_request(button, width, -1); |
599 | spin = GTK_SPIN_BUTTON(button)((((GtkSpinButton*) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((gtk_spin_button_get_type ())))))); |
600 | gtk_spin_button_set_numeric(spin, TRUE(!(0))); |
601 | if (!data) |
602 | data = (gpointer) spin; |
603 | if (cb_func) |
604 | g_signal_connect(G_OBJECT(adj), "value_changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((adj)), (((GType) ((20) << (2)))))) ))), ("value_changed"), (((GCallback) (cb_func))), (data), (( void*)0), (GConnectFlags) 0) |
605 | G_CALLBACK(cb_func), data)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((adj)), (((GType) ((20) << (2)))))) ))), ("value_changed"), (((GCallback) (cb_func))), (data), (( void*)0), (GConnectFlags) 0); |
606 | if (box) |
607 | { |
608 | if (right_align && string) |
609 | { |
610 | label = gtk_label_new(string); |
611 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 1.0, 0.5); |
612 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 2); |
613 | } |
614 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), button, FALSE(0), FALSE(0), 2); |
615 | if (!right_align && string) |
616 | { |
617 | label = gtk_label_new(string); |
618 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 0, 0.5); |
619 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 2); |
620 | } |
621 | } |
622 | } |
623 | |
624 | GtkWidget * |
625 | gkrellm_gtk_scrolled_vbox(GtkWidget *box, GtkWidget **scr, |
626 | GtkPolicyType h_policy, GtkPolicyType v_policy) |
627 | { |
628 | GtkWidget *scrolled, |
629 | *vbox; |
630 | |
631 | scrolled = gtk_scrolled_window_new(NULL((void*)0), NULL((void*)0)); |
632 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled)((((GtkScrolledWindow*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_scrolled_window_get_type ())))))), |
633 | h_policy, v_policy); |
634 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), scrolled, TRUE(!(0)), TRUE(!(0)), 0); |
635 | vbox = gtk_vbox_new(FALSE(0), 2); |
636 | gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled)((((GtkScrolledWindow*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_scrolled_window_get_type ())))))), vbox); |
637 | if (scr) |
638 | *scr = scrolled; |
639 | return vbox; |
640 | } |
641 | |
642 | /* frame_border_width - border around outside of frame. |
643 | | vbox_pad - pad between widgets to be packed in returned vbox. |
644 | | vbox_border_width - border between returned vbox and frame. |
645 | */ |
646 | GtkWidget * |
647 | gkrellm_gtk_framed_vbox(GtkWidget *box, gchar *label, gint frame_border_width, |
648 | gboolean frame_expand, gint vbox_pad, gint vbox_border_width) |
649 | { |
650 | GtkWidget *frame, *lbl; |
651 | GtkWidget *vbox; |
652 | |
653 | frame = gtk_frame_new(NULL((void*)0)); |
654 | /* gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE); */ |
655 | lbl = gtk_label_new(NULL((void*)0)); |
656 | gtk_label_set_markup(GTK_LABEL(lbl)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (lbl)), ((gtk_label_get_type ())))))), label); |
657 | gtk_frame_set_label_widget(GTK_FRAME(frame)((((GtkFrame*) g_type_check_instance_cast ((GTypeInstance*) ( (frame)), ((gtk_frame_get_type ())))))), lbl); |
658 | |
659 | gtk_container_set_border_width(GTK_CONTAINER(frame)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((frame)), ((gtk_container_get_type ())))))), frame_border_width); |
660 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), frame, frame_expand, frame_expand, 0); |
661 | vbox = gtk_vbox_new(FALSE(0), vbox_pad); |
662 | gtk_container_set_border_width(GTK_CONTAINER(vbox)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((gtk_container_get_type ())))))), vbox_border_width); |
663 | gtk_container_add(GTK_CONTAINER(frame)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((frame)), ((gtk_container_get_type ())))))), vbox); |
664 | return vbox; |
665 | } |
666 | |
667 | GtkWidget * |
668 | gkrellm_gtk_framed_vbox_end(GtkWidget *box, gchar *label, |
669 | gint frame_border_width, gboolean frame_expand, |
670 | gint vbox_pad, gint vbox_border_width) |
671 | { |
672 | GtkWidget *frame; |
673 | GtkWidget *vbox; |
674 | |
675 | frame = gtk_frame_new(label); |
676 | gtk_container_set_border_width(GTK_CONTAINER(frame)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((frame)), ((gtk_container_get_type ())))))), frame_border_width); |
677 | gtk_box_pack_end(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), frame, frame_expand, frame_expand, 0); |
678 | vbox = gtk_vbox_new(FALSE(0), vbox_pad); |
679 | gtk_container_set_border_width(GTK_CONTAINER(vbox)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((gtk_container_get_type ())))))), vbox_border_width); |
680 | gtk_container_add(GTK_CONTAINER(frame)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((frame)), ((gtk_container_get_type ())))))), vbox); |
681 | return vbox; |
682 | } |
683 | |
684 | GtkWidget * |
685 | gkrellm_gtk_category_vbox(GtkWidget *box, gchar *category_header, |
686 | gint header_pad, gint box_pad, gboolean pack_start) |
687 | { |
688 | GtkWidget *vbox, *vbox1, *hbox, *label; |
689 | gchar *s; |
690 | |
691 | vbox = gtk_vbox_new(FALSE(0), 0); |
692 | if (pack_start) |
693 | gtk_box_pack_start(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), vbox, FALSE(0), FALSE(0), 0); |
694 | else |
695 | gtk_box_pack_end(GTK_BOX(box)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((box )), ((gtk_box_get_type ())))))), vbox, FALSE(0), FALSE(0), 0); |
696 | |
697 | if (category_header) |
698 | { |
699 | label = gtk_label_new(NULL((void*)0)); |
700 | s = g_strconcat("<span weight=\"bold\">", category_header, |
701 | "</span>",NULL((void*)0)); |
702 | gtk_label_set_markup(GTK_LABEL(label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (label)), ((gtk_label_get_type ())))))), s); |
703 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 0.0, 0.5); |
704 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), header_pad); |
705 | g_free(s); |
706 | } |
707 | |
708 | hbox = gtk_hbox_new(FALSE(0), 0); |
709 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 0); |
710 | |
711 | label = gtk_label_new(" "); |
712 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
713 | vbox1 = gtk_vbox_new(FALSE(0), box_pad); |
714 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), vbox1, TRUE(!(0)), TRUE(!(0)), 0); |
715 | |
716 | /* Add some bottom pad */ |
717 | label = gtk_label_new(""); |
718 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
719 | |
720 | return vbox1; |
721 | } |
722 | |
723 | GtkWidget * |
724 | gkrellm_gtk_notebook_page(GtkWidget *tabs, char *name) |
725 | { |
726 | GtkWidget *label; |
727 | GtkWidget *vbox; |
728 | |
729 | vbox = gtk_vbox_new(FALSE(0), 0); |
730 | gtk_container_set_border_width(GTK_CONTAINER(vbox)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((gtk_container_get_type ())))))), 0); |
731 | |
732 | label = gtk_label_new(name); |
733 | gtk_notebook_append_page(GTK_NOTEBOOK(tabs)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance* ) ((tabs)), ((gtk_notebook_get_type ())))))), vbox, label); |
734 | |
735 | return vbox; |
736 | } |
737 | |
738 | GtkWidget * |
739 | gkrellm_gtk_framed_notebook_page(GtkWidget *tabs, char *name) |
740 | { |
741 | GtkWidget *vbox; |
742 | |
743 | vbox = gkrellm_gtk_notebook_page(tabs, name); |
744 | vbox = gkrellm_gtk_framed_vbox(vbox, NULL((void*)0), 2, TRUE(!(0)), 4, 4); |
745 | return vbox; |
746 | } |
747 | |
748 | static void |
749 | create_about_tab(GtkWidget *vbox) |
750 | { |
751 | GtkWidget *label; |
752 | gchar *buf; |
753 | |
754 | vbox = gkrellm_gtk_framed_vbox(vbox, NULL((void*)0), 2, TRUE(!(0)), 0, 0); |
755 | label = gtk_label_new(""); |
756 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
757 | |
758 | buf = g_strdup_printf(_("GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n"dcgettext ("gkrellm", "GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n" "Copyright (c) 1999-2010 by Bill Wilson\n" "billw@gkrellm.net\n" "http://gkrellm.net\n\n" "Released under the GNU General Public License" , 5) |
759 | "Copyright (c) 1999-2010 by Bill Wilson\n"dcgettext ("gkrellm", "GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n" "Copyright (c) 1999-2010 by Bill Wilson\n" "billw@gkrellm.net\n" "http://gkrellm.net\n\n" "Released under the GNU General Public License" , 5) |
760 | "billw@gkrellm.net\n"dcgettext ("gkrellm", "GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n" "Copyright (c) 1999-2010 by Bill Wilson\n" "billw@gkrellm.net\n" "http://gkrellm.net\n\n" "Released under the GNU General Public License" , 5) |
761 | "http://gkrellm.net\n\n"dcgettext ("gkrellm", "GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n" "Copyright (c) 1999-2010 by Bill Wilson\n" "billw@gkrellm.net\n" "http://gkrellm.net\n\n" "Released under the GNU General Public License" , 5) |
762 | "Released under the GNU General Public License")dcgettext ("gkrellm", "GKrellM %d.%d.%d%s\nGNU Krell Monitors\n\n" "Copyright (c) 1999-2010 by Bill Wilson\n" "billw@gkrellm.net\n" "http://gkrellm.net\n\n" "Released under the GNU General Public License" , 5), |
763 | GKRELLM_VERSION_MAJOR2, GKRELLM_VERSION_MINOR3, |
764 | GKRELLM_VERSION_REV5, GKRELLM_EXTRAVERSION""); |
765 | label = gtk_label_new(buf); |
766 | gtk_label_set_justify(GTK_LABEL(label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (label)), ((gtk_label_get_type ())))))), GTK_JUSTIFY_CENTER); |
767 | g_free(buf); |
768 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
769 | |
770 | label = gtk_label_new(""); |
771 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
772 | |
773 | #if defined(__APPLE__) |
774 | buf = g_strdup_printf(_("Mac OS X code was contributed by:\n"dcgettext ("gkrellm", "Mac OS X code was contributed by:\n" "Ben Hines <bhines@alumni.ucsd.edu>\n" "and\n" "Hajimu UMEMOTO <ume@mahoroba.org>", 5) |
775 | "Ben Hines <bhines@alumni.ucsd.edu>\n"dcgettext ("gkrellm", "Mac OS X code was contributed by:\n" "Ben Hines <bhines@alumni.ucsd.edu>\n" "and\n" "Hajimu UMEMOTO <ume@mahoroba.org>", 5) |
776 | "and\n"dcgettext ("gkrellm", "Mac OS X code was contributed by:\n" "Ben Hines <bhines@alumni.ucsd.edu>\n" "and\n" "Hajimu UMEMOTO <ume@mahoroba.org>", 5) |
777 | "Hajimu UMEMOTO <ume@mahoroba.org>")dcgettext ("gkrellm", "Mac OS X code was contributed by:\n" "Ben Hines <bhines@alumni.ucsd.edu>\n" "and\n" "Hajimu UMEMOTO <ume@mahoroba.org>", 5)); |
778 | label = gtk_label_new(buf); |
779 | g_free(buf); |
780 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
781 | #endif |
782 | #if defined(__FreeBSD__) |
783 | buf = g_strdup_printf( |
784 | _("FreeBSD system dependent code was contributed by:\n"dcgettext ("gkrellm", "FreeBSD system dependent code was contributed by:\n" "Hajimu UMEMOTO <ume@mahoroba.org>", 5) |
785 | "Hajimu UMEMOTO <ume@mahoroba.org>")dcgettext ("gkrellm", "FreeBSD system dependent code was contributed by:\n" "Hajimu UMEMOTO <ume@mahoroba.org>", 5)); |
786 | label = gtk_label_new(buf); |
787 | g_free(buf); |
788 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
789 | #endif |
790 | #if defined(__DragonFly__) |
791 | buf = g_strdup_printf( |
792 | _("DragonFly system dependent code was contributed by:\n"dcgettext ("gkrellm", "DragonFly system dependent code was contributed by:\n" "Joerg Sonnenberger <joerg@bec.de>", 5) |
793 | "Joerg Sonnenberger <joerg@bec.de>")dcgettext ("gkrellm", "DragonFly system dependent code was contributed by:\n" "Joerg Sonnenberger <joerg@bec.de>", 5)); |
794 | label = gtk_label_new(buf); |
795 | g_free(buf); |
796 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
797 | #endif |
798 | #if defined(__NetBSD__) |
799 | buf = g_strdup_printf( |
800 | _("NetBSD system dependent code was contributed by:\n"dcgettext ("gkrellm", "NetBSD system dependent code was contributed by:\n" "Anthony Mallet <anthony.mallet@useless-ficus.net>", 5 ) |
801 | "Anthony Mallet <anthony.mallet@useless-ficus.net>")dcgettext ("gkrellm", "NetBSD system dependent code was contributed by:\n" "Anthony Mallet <anthony.mallet@useless-ficus.net>", 5 )); |
802 | label = gtk_label_new(buf); |
803 | g_free(buf); |
804 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
805 | #endif |
806 | #if defined(__solaris__) |
807 | buf = g_strdup_printf( |
808 | _("Solaris system dependent code was contributed by:\n"dcgettext ("gkrellm", "Solaris system dependent code was contributed by:\n" "Daisuke Yabuki <dxy@acm.org>", 5) |
809 | "Daisuke Yabuki <dxy@acm.org>")dcgettext ("gkrellm", "Solaris system dependent code was contributed by:\n" "Daisuke Yabuki <dxy@acm.org>", 5)); |
810 | label = gtk_label_new(buf); |
811 | g_free(buf); |
812 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
813 | #endif |
814 | #if defined(WIN32) |
815 | buf = g_strdup_printf( |
816 | _("Windows system dependent code was contributed by:\n"dcgettext ("gkrellm", "Windows system dependent code was contributed by:\n" "Bill Nalen <bill@nalens.com>\n" "Stefan Gehn <stefan+gkrellm@srcbox.net>\n" , 5) |
817 | "Bill Nalen <bill@nalens.com>\n"dcgettext ("gkrellm", "Windows system dependent code was contributed by:\n" "Bill Nalen <bill@nalens.com>\n" "Stefan Gehn <stefan+gkrellm@srcbox.net>\n" , 5) |
818 | "Stefan Gehn <stefan+gkrellm@srcbox.net>\n")dcgettext ("gkrellm", "Windows system dependent code was contributed by:\n" "Bill Nalen <bill@nalens.com>\n" "Stefan Gehn <stefan+gkrellm@srcbox.net>\n" , 5)); |
819 | label = gtk_label_new(buf); |
820 | g_free(buf); |
821 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 0); |
822 | #endif // !WIN32 |
823 | gtk_label_set_justify(GTK_LABEL(label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (label)), ((gtk_label_get_type ())))))), GTK_JUSTIFY_CENTER); |
824 | } |
825 | |
826 | |
827 | /* ------------------General Settings---------------------------------*/ |
828 | static GtkWidget |
829 | *enable_hst_button, |
830 | *hostname_short_button, |
831 | *enable_sysname_button, |
832 | *save_position_button; |
833 | |
834 | #if !defined(WIN32) |
835 | static GtkWidget |
836 | *sticky_state_button, |
837 | *dock_type_button, |
838 | *decorated_button, |
839 | *skip_taskbar_button, |
840 | *skip_pager_button, |
841 | *above_button, |
842 | *below_button; |
843 | #endif // !WIN32 |
844 | |
845 | GtkWidget *track_gtk_button, |
846 | *allow_multiple_button; |
847 | GtkWidget *on_top_button; |
848 | |
849 | |
850 | |
851 | static void |
852 | cb_width_spin(GtkWidget *widget, GtkSpinButton *spin) |
853 | { |
854 | _GK.chart_width = gtk_spin_button_get_value_as_int(spin); |
855 | gkrellm_build(); |
856 | } |
857 | |
858 | static void |
859 | cb_HZ_spin(GtkWidget *widget, GtkSpinButton *spin) |
860 | { |
861 | gint n; |
862 | |
863 | n = _GK.update_HZ; |
864 | _GK.update_HZ = gtk_spin_button_get_value_as_int(spin); |
865 | if (n != _GK.update_HZ) |
866 | gkrellm_start_timer(_GK.update_HZ); |
867 | } |
868 | |
869 | static void |
870 | cb_hostname_sysname(GtkWidget *widget, gpointer data) |
871 | { |
872 | _GK.enable_hostname = GTK_TOGGLE_BUTTON(enable_hst_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((enable_hst_button)), ((gtk_toggle_button_get_type ())))) ))->active; |
873 | if (hostname_short_button) |
874 | _GK.hostname_short = GTK_TOGGLE_BUTTON(hostname_short_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((hostname_short_button)), ((gtk_toggle_button_get_type () ))))))->active; |
875 | _GK.enable_system_name = GTK_TOGGLE_BUTTON(enable_sysname_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((enable_sysname_button)), ((gtk_toggle_button_get_type () ))))))->active; |
876 | gkrellm_apply_hostname_config(); |
877 | } |
878 | |
879 | static void |
880 | cb_general(void) |
881 | { |
882 | #if !defined(WIN32) |
883 | gint n; |
884 | gboolean new_state; |
885 | #endif |
886 | |
887 | if (allow_multiple_button) |
888 | _GK.allow_multiple_instances = |
889 | GTK_TOGGLE_BUTTON(allow_multiple_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((allow_multiple_button)), ((gtk_toggle_button_get_type () ))))))->active; |
890 | if (on_top_button) |
891 | _GK.on_top = GTK_TOGGLE_BUTTON(on_top_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((on_top_button)), ((gtk_toggle_button_get_type ()))))))->active; |
892 | |
893 | _GK.save_position = GTK_TOGGLE_BUTTON(save_position_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((save_position_button)), ((gtk_toggle_button_get_type ()) )))))->active; |
894 | #if !defined(WIN32) |
895 | if (sticky_state_button) |
896 | { |
897 | n = GTK_TOGGLE_BUTTON(sticky_state_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((sticky_state_button)), ((gtk_toggle_button_get_type ())) ))))->active; |
898 | new_state = (n != _GK.sticky_state); |
899 | _GK.sticky_state = n; |
900 | if (new_state) |
901 | { |
902 | GtkWidget *top_window = gkrellm_get_top_window(); |
903 | |
904 | if (_GK.sticky_state) |
905 | gtk_window_stick(GTK_WINDOW(top_window)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (top_window)), ((gtk_window_get_type ()))))))); |
906 | else |
907 | gtk_window_unstick(GTK_WINDOW(top_window)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (top_window)), ((gtk_window_get_type ()))))))); |
908 | } |
909 | } |
910 | |
911 | if (decorated_button) /* restart for change to take effect */ |
912 | _GK.decorated = GTK_TOGGLE_BUTTON(decorated_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((decorated_button)), ((gtk_toggle_button_get_type ()))))) )->active; |
913 | |
914 | if (skip_taskbar_button) |
915 | { |
916 | n = GTK_TOGGLE_BUTTON(skip_taskbar_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((skip_taskbar_button)), ((gtk_toggle_button_get_type ())) ))))->active; |
917 | new_state = (n != _GK.state_skip_taskbar); |
918 | _GK.state_skip_taskbar = n; |
919 | if (new_state) |
920 | gkrellm_winop_state_skip_taskbar(n); |
921 | } |
922 | if (skip_pager_button) |
923 | { |
924 | n = GTK_TOGGLE_BUTTON(skip_pager_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((skip_pager_button)), ((gtk_toggle_button_get_type ())))) ))->active; |
925 | new_state = (n != _GK.state_skip_pager); |
926 | _GK.state_skip_pager = n; |
927 | if (new_state) |
928 | gkrellm_winop_state_skip_pager(n); |
929 | } |
930 | if (above_button) |
931 | { |
932 | n = GTK_TOGGLE_BUTTON(above_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((above_button)), ((gtk_toggle_button_get_type ()))))))->active; |
933 | new_state = (n != _GK.state_above); |
934 | _GK.state_above = n; |
935 | if (new_state) |
936 | { |
937 | if (n && _GK.state_below) |
938 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(below_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((below_button)), ((gtk_toggle_button_get_type ())))))), |
939 | FALSE(0)); |
940 | gkrellm_winop_state_above(n); |
941 | } |
942 | } |
943 | if (below_button) |
944 | { |
945 | n = GTK_TOGGLE_BUTTON(below_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((below_button)), ((gtk_toggle_button_get_type ()))))))->active; |
946 | new_state = (n != _GK.state_below); |
947 | _GK.state_below = n; |
948 | if (new_state) |
949 | { |
950 | if (n && _GK.state_above) |
951 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(above_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((above_button)), ((gtk_toggle_button_get_type ())))))), |
952 | FALSE(0)); |
953 | gkrellm_winop_state_below(n); |
954 | } |
955 | } |
956 | #endif // !WIN32 |
957 | } |
958 | |
959 | #ifndef WIN32 |
960 | static void |
961 | cb_dock_type(GtkWidget *widget, gpointer data) |
962 | { |
963 | gboolean sensitive; |
964 | |
965 | _GK.dock_type = GTK_TOGGLE_BUTTON(dock_type_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((dock_type_button)), ((gtk_toggle_button_get_type ()))))) )->active; |
966 | sensitive = !_GK.dock_type; |
967 | if (!sensitive) |
968 | { |
969 | gtk_toggle_button_set_active( |
970 | GTK_TOGGLE_BUTTON(decorated_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((decorated_button)), ((gtk_toggle_button_get_type ()))))) ), FALSE(0)); |
971 | gtk_toggle_button_set_active( |
972 | GTK_TOGGLE_BUTTON(skip_taskbar_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((skip_taskbar_button)), ((gtk_toggle_button_get_type ())) )))), FALSE(0)); |
973 | gtk_toggle_button_set_active( |
974 | GTK_TOGGLE_BUTTON(skip_pager_button)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance *) ((skip_pager_button)), ((gtk_toggle_button_get_type ())))) )), FALSE(0)); |
975 | } |
976 | gtk_widget_set_sensitive(decorated_button, sensitive); |
977 | gtk_widget_set_sensitive(skip_taskbar_button, sensitive); |
978 | gtk_widget_set_sensitive(skip_pager_button, sensitive); |
979 | } |
980 | #endif // WIN32 |
981 | |
982 | static gchar *general_info_text[] = |
983 | { |
984 | N_("<h>Krells\n")("<h>Krells\n"), |
985 | N_("Krells are the horizontally moving indicators below each chart and\n"("Krells are the horizontally moving indicators below each chart and\n" "on meter style monitors. Depending on the monitor, they show fast\n" "response data rates, a percentage of some capacity, or something else.\n" ) |
986 | "on meter style monitors. Depending on the monitor, they show fast\n"("Krells are the horizontally moving indicators below each chart and\n" "on meter style monitors. Depending on the monitor, they show fast\n" "response data rates, a percentage of some capacity, or something else.\n" ) |
987 | "response data rates, a percentage of some capacity, or something else.\n")("Krells are the horizontally moving indicators below each chart and\n" "on meter style monitors. Depending on the monitor, they show fast\n" "response data rates, a percentage of some capacity, or something else.\n" ), |
988 | "\n", |
989 | N_("<h>Charts\n")("<h>Charts\n"), |
990 | N_("The default for most charts is to automatically adjust the number of\n"("The default for most charts is to automatically adjust the number of\n" "grid lines drawn and the resolution per grid so drawn data will be\n" "nicely visible. You may change this to fixed grids of 1-5 and/or\n" "fixed grid resolutions in the chart config windows. However,\n" "some combination of the auto scaling modes may give best results.\n" ) |
991 | "grid lines drawn and the resolution per grid so drawn data will be\n"("The default for most charts is to automatically adjust the number of\n" "grid lines drawn and the resolution per grid so drawn data will be\n" "nicely visible. You may change this to fixed grids of 1-5 and/or\n" "fixed grid resolutions in the chart config windows. However,\n" "some combination of the auto scaling modes may give best results.\n" ) |
992 | "nicely visible. You may change this to fixed grids of 1-5 and/or\n"("The default for most charts is to automatically adjust the number of\n" "grid lines drawn and the resolution per grid so drawn data will be\n" "nicely visible. You may change this to fixed grids of 1-5 and/or\n" "fixed grid resolutions in the chart config windows. However,\n" "some combination of the auto scaling modes may give best results.\n" ) |
993 | "fixed grid resolutions in the chart config windows. However,\n"("The default for most charts is to automatically adjust the number of\n" "grid lines drawn and the resolution per grid so drawn data will be\n" "nicely visible. You may change this to fixed grids of 1-5 and/or\n" "fixed grid resolutions in the chart config windows. However,\n" "some combination of the auto scaling modes may give best results.\n" ) |
994 | "some combination of the auto scaling modes may give best results.\n")("The default for most charts is to automatically adjust the number of\n" "grid lines drawn and the resolution per grid so drawn data will be\n" "nicely visible. You may change this to fixed grids of 1-5 and/or\n" "fixed grid resolutions in the chart config windows. However,\n" "some combination of the auto scaling modes may give best results.\n" ), |
995 | "\n", |
996 | N_("See the README or do a \"man gkrellm\" for more information.\n")("See the README or do a \"man gkrellm\" for more information.\n" ), |
997 | "\n", |
998 | N_("<h>Chart Labels\n")("<h>Chart Labels\n"), |
999 | N_("Chart label format strings place text on charts using position codes:\n")("Chart label format strings place text on charts using position codes:\n" ), |
1000 | N_("\t\\t top left\n")("\t\\t top left\n"), |
1001 | N_("\t\\b bottom left\n")("\t\\b bottom left\n"), |
1002 | N_("\t\\n next line\n")("\t\\n next line\n"), |
1003 | N_("\t\\N next line only if last string had visible characters\n")("\t\\N next line only if last string had visible characters\n" ), |
1004 | N_("\t\\p previous line\n")("\t\\p previous line\n"), |
1005 | N_("\t\\c center the text\n")("\t\\c center the text\n"), |
1006 | N_("\t\\C begin drawing text at the center\n")("\t\\C begin drawing text at the center\n"), |
1007 | N_("\t\\r right justify\n")("\t\\r right justify\n"), |
1008 | N_("\t\\f use alternate font for the next string\n")("\t\\f use alternate font for the next string\n"), |
1009 | N_("\t\\w use the following string to define a field width\n")("\t\\w use the following string to define a field width\n" ), |
1010 | N_("\t\\a draw left justified in the defined field width\n")("\t\\a draw left justified in the defined field width\n"), |
1011 | N_("\t\\e draw right justified in the defined field width\n")("\t\\e draw right justified in the defined field width\n" ), |
1012 | N_("\t\\. no-op. Used to break a string into two strings.\n")("\t\\. no-op. Used to break a string into two strings.\n" ), |
1013 | N_("\t\\D0 bottom of charts first data view (D2 for second data view ...)\n")("\t\\D0 bottom of charts first data view (D2 for second data view ...)\n" ), |
1014 | N_("\t\\D1 top of charts first data view (D3 for second data view ...)\n")("\t\\D1 top of charts first data view (D3 for second data view ...)\n" ), |
1015 | |
1016 | N_("<h>\nCommands\n")("<h>\nCommands\n"), |
1017 | N_("\tMany monitors can be configured to launch commands. Just enter the\n"("\tMany monitors can be configured to launch commands. Just enter the\n" "\tcommand where you see a \"command\" entry and also a comment if you\n" "\twant a tooltip to appear for the command. After a command is entered,\n" "\tfor a monitor, a button for launching it will become visible when you\n" "\tmove the mouse into the panel area of the monitor.\n\n") |
1018 | "\tcommand where you see a \"command\" entry and also a comment if you\n"("\tMany monitors can be configured to launch commands. Just enter the\n" "\tcommand where you see a \"command\" entry and also a comment if you\n" "\twant a tooltip to appear for the command. After a command is entered,\n" "\tfor a monitor, a button for launching it will become visible when you\n" "\tmove the mouse into the panel area of the monitor.\n\n") |
1019 | "\twant a tooltip to appear for the command. After a command is entered,\n"("\tMany monitors can be configured to launch commands. Just enter the\n" "\tcommand where you see a \"command\" entry and also a comment if you\n" "\twant a tooltip to appear for the command. After a command is entered,\n" "\tfor a monitor, a button for launching it will become visible when you\n" "\tmove the mouse into the panel area of the monitor.\n\n") |
1020 | "\tfor a monitor, a button for launching it will become visible when you\n"("\tMany monitors can be configured to launch commands. Just enter the\n" "\tcommand where you see a \"command\" entry and also a comment if you\n" "\twant a tooltip to appear for the command. After a command is entered,\n" "\tfor a monitor, a button for launching it will become visible when you\n" "\tmove the mouse into the panel area of the monitor.\n\n") |
1021 | "\tmove the mouse into the panel area of the monitor.\n\n")("\tMany monitors can be configured to launch commands. Just enter the\n" "\tcommand where you see a \"command\" entry and also a comment if you\n" "\twant a tooltip to appear for the command. After a command is entered,\n" "\tfor a monitor, a button for launching it will become visible when you\n" "\tmove the mouse into the panel area of the monitor.\n\n"), |
1022 | N_("See the README or do a \"man gkrellm\" for more information.\n")("See the README or do a \"man gkrellm\" for more information.\n" ), |
1023 | "\n", |
1024 | |
1025 | N_("<h>\nMouse Button Actions:\n")("<h>\nMouse Button Actions:\n"), |
1026 | N_("<b>\tLeft ")("<b>\tLeft "), |
1027 | N_("clicking on charts will toggle a display of some extra info.\n")("clicking on charts will toggle a display of some extra info.\n" ), |
1028 | N_("<b>\tRight ")("<b>\tRight "), |
1029 | N_("clicking on charts brings up a chart configuration window.\n")("clicking on charts brings up a chart configuration window.\n" ), |
1030 | N_("<b>\tRight ")("<b>\tRight "), |
1031 | N_("clicking on many panels opens its monitor configuration window.\n")("clicking on many panels opens its monitor configuration window.\n" ) |
1032 | }; |
1033 | |
1034 | static void |
1035 | create_general_tab(GtkWidget *tab_vbox) |
1036 | { |
1037 | GtkWidget *tabs; |
1038 | GtkWidget *vbox, *vbox1; |
1039 | #if !defined(WIN32) |
1040 | GtkWidget *vbox2; |
1041 | #endif |
1042 | GtkWidget *hbox; |
1043 | GtkWidget *label, *text; |
1044 | gint i; |
1045 | |
1046 | tabs = gtk_notebook_new(); |
1047 | gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance* ) ((tabs)), ((gtk_notebook_get_type ())))))), GTK_POS_TOP); |
1048 | gtk_box_pack_start(GTK_BOX(tab_vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((tab_vbox )), ((gtk_box_get_type ())))))), tabs, TRUE(!(0)), TRUE(!(0)), 0); |
1049 | |
1050 | /* --Options tab */ |
1051 | vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Options")dcgettext ("gkrellm", "Options", 5)); |
1052 | vbox1 = gtk_vbox_new(FALSE(0), 0); |
1053 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), vbox1, FALSE(0), FALSE(0), 0); |
1054 | hbox = gtk_hbox_new (FALSE(0), 0); |
1055 | gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1 )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 0); |
1056 | |
1057 | gkrellm_gtk_check_button_connected(hbox, &enable_hst_button, |
1058 | _GK.enable_hostname, FALSE(0), FALSE(0), 0, |
1059 | cb_hostname_sysname, NULL((void*)0), |
1060 | _("Hostname display")dcgettext ("gkrellm", "Hostname display", 5)); |
1061 | |
1062 | if (gkrellm_hostname_can_shorten()) |
1063 | gkrellm_gtk_check_button_connected(hbox, &hostname_short_button, |
1064 | _GK.hostname_short, FALSE(0), FALSE(0), 10, |
1065 | cb_hostname_sysname, NULL((void*)0), |
1066 | _("Short hostname")dcgettext ("gkrellm", "Short hostname", 5)); |
1067 | |
1068 | gkrellm_gtk_check_button_connected(vbox, &enable_sysname_button, |
1069 | _GK.enable_system_name, FALSE(0), FALSE(0), 0, |
1070 | cb_hostname_sysname, NULL((void*)0), |
1071 | _("System name display")dcgettext ("gkrellm", "System name display", 5)); |
1072 | |
1073 | gkrellm_gtk_check_button_connected(vbox, &save_position_button, |
1074 | _GK.save_position, FALSE(0), FALSE(0), 6, |
1075 | cb_general, NULL((void*)0), |
1076 | _("Remember screen location at exit and move to it at next startup")dcgettext ("gkrellm", "Remember screen location at exit and move to it at next startup" , 5)); |
1077 | |
1078 | #if !defined(WIN32) |
1079 | gkrellm_gtk_check_button_connected(vbox, &allow_multiple_button, |
1080 | _GK.allow_multiple_instances, FALSE(0), FALSE(0), 0, |
1081 | cb_general, NULL((void*)0), |
1082 | _("Allow multiple instances")dcgettext ("gkrellm", "Allow multiple instances", 5)); |
1083 | #endif // !WIN32 |
1084 | |
1085 | #if defined(WIN32) |
1086 | gkrellm_gtk_check_button_connected(vbox, &on_top_button, |
1087 | _GK.on_top, FALSE(0), FALSE(0), 0, |
1088 | cb_general, NULL((void*)0), |
1089 | _("Make gkrellm a topmost window (restart gkrellm for this to take effect).")dcgettext ("gkrellm", "Make gkrellm a topmost window (restart gkrellm for this to take effect)." , 5)); |
1090 | #endif // WIN32 |
1091 | |
1092 | if (_GK.client_mode) |
1093 | { |
1094 | hbox = gtk_hbox_new(FALSE(0), 0); |
1095 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), hbox, FALSE(0), TRUE(!(0)), 6); |
1096 | gkrellm_gtk_alert_button(hbox, NULL((void*)0), FALSE(0), FALSE(0), 4, TRUE(!(0)), |
1097 | gkrellm_gkrellmd_disconnect_cb, NULL((void*)0)); |
1098 | label = gtk_label_new(_("gkrellmd server disconnect")dcgettext ("gkrellm", "gkrellmd server disconnect", 5)); |
1099 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, FALSE(0), TRUE(!(0)), 4); |
1100 | } |
1101 | |
1102 | vbox = gkrellm_gtk_framed_vbox_end(vbox, NULL((void*)0), 4, FALSE(0), 0, 2); |
1103 | gkrellm_gtk_spin_button(vbox, NULL((void*)0), (gfloat) _GK.update_HZ, |
1104 | 1.0, 20.0, 1.0, 1.0, 0, 55, |
1105 | cb_HZ_spin, NULL((void*)0), FALSE(0), |
1106 | _("Krell and LED updates per second.")dcgettext ("gkrellm", "Krell and LED updates per second.", 5)); |
1107 | |
1108 | gkrellm_gtk_spin_button(vbox, NULL((void*)0), (gfloat) _GK.chart_width, |
1109 | (gfloat) CHART_WIDTH_MIN25, (gfloat) CHART_WIDTH_MAX1000, |
1110 | 5.0, 10.0, 0, 55, |
1111 | cb_width_spin, NULL((void*)0), FALSE(0), |
1112 | _("GKrellM width")dcgettext ("gkrellm", "GKrellM width", 5)); |
1113 | |
1114 | #if !defined(WIN32) |
1115 | /* --Window options tab */ |
1116 | vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Properties")dcgettext ("gkrellm", "Properties", 5)); |
1117 | gkrellm_gtk_check_button_connected(vbox, &sticky_state_button, |
1118 | _GK.sticky_state, FALSE(0), FALSE(0), 0, cb_general, NULL((void*)0), |
1119 | _("Set sticky state")dcgettext ("gkrellm", "Set sticky state", 5)); |
1120 | gkrellm_gtk_check_button_connected(vbox, &above_button, |
1121 | _GK.state_above, FALSE(0), FALSE(0), 0, cb_general, NULL((void*)0), |
1122 | _("Set on top of other windows of the same type")dcgettext ("gkrellm", "Set on top of other windows of the same type" , 5)); |
1123 | gkrellm_gtk_check_button_connected(vbox, &below_button, |
1124 | _GK.state_below, FALSE(0), FALSE(0), 0, cb_general, NULL((void*)0), |
1125 | _("Set below other windows of the same type")dcgettext ("gkrellm", "Set below other windows of the same type" , 5)); |
1126 | |
1127 | vbox1 = gkrellm_gtk_framed_vbox(vbox, NULL((void*)0), 4, FALSE(0), 2, 0); |
1128 | vbox2 = gkrellm_gtk_framed_vbox(vbox1, NULL((void*)0), 0, FALSE(0), 0, 0); |
1129 | gkrellm_gtk_check_button_connected(vbox2, &dock_type_button, |
1130 | _GK.dock_type, FALSE(0), FALSE(0), 0, |
1131 | cb_dock_type, NULL((void*)0), |
1132 | _("Set window type to be a dock or panel")dcgettext ("gkrellm", "Set window type to be a dock or panel" , 5)); |
1133 | |
1134 | vbox2 = gkrellm_gtk_framed_vbox(vbox1, NULL((void*)0), 0, FALSE(0), 0, 0); |
1135 | gkrellm_gtk_check_button_connected(vbox2, &decorated_button, |
1136 | _GK.decorated, FALSE(0), FALSE(0), 0, cb_general, NULL((void*)0), |
1137 | _("Use window manager decorations")dcgettext ("gkrellm", "Use window manager decorations", 5)); |
1138 | |
1139 | gkrellm_gtk_check_button_connected(vbox2, &skip_taskbar_button, |
1140 | _GK.state_skip_taskbar, FALSE(0), FALSE(0), 0, cb_general, NULL((void*)0), |
1141 | _("Do not include on a taskbar")dcgettext ("gkrellm", "Do not include on a taskbar", 5)); |
1142 | |
1143 | gkrellm_gtk_check_button_connected(vbox2, &skip_pager_button, |
1144 | _GK.state_skip_pager, FALSE(0), FALSE(0), 0, cb_general, NULL((void*)0), |
1145 | _("Do not include on a pager")dcgettext ("gkrellm", "Do not include on a pager", 5)); |
1146 | |
1147 | if (_GK.dock_type) |
1148 | { |
1149 | gtk_widget_set_sensitive(decorated_button, FALSE(0)); |
1150 | gtk_widget_set_sensitive(skip_taskbar_button, FALSE(0)); |
1151 | gtk_widget_set_sensitive(skip_pager_button, FALSE(0)); |
1152 | } |
1153 | |
1154 | text = gtk_label_new( |
1155 | _("Some of these properties require a standards compliant window manager.\n"dcgettext ("gkrellm", "Some of these properties require a standards compliant window manager.\n" "You may have to restart gkrellm for them to take effect.\n" , 5) |
1156 | "You may have to restart gkrellm for them to take effect.\n")dcgettext ("gkrellm", "Some of these properties require a standards compliant window manager.\n" "You may have to restart gkrellm for them to take effect.\n" , 5)); |
1157 | gtk_box_pack_end(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), text, FALSE(0), TRUE(!(0)), 4); |
1158 | #endif // !WIN32 |
1159 | |
1160 | /* --Info tab */ |
1161 | vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Info")dcgettext ("gkrellm", "Info", 5)); |
1162 | text = gkrellm_gtk_scrolled_text_view(vbox, NULL((void*)0), |
1163 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
1164 | |
1165 | for (i = 0; i < sizeof(general_info_text)/sizeof(gchar *); ++i) |
1166 | gkrellm_gtk_text_view_append(text, _(general_info_text[i])dcgettext ("gkrellm", general_info_text[i], 5)); |
1167 | } |
1168 | |
1169 | |
1170 | /* ------------------Themes Tab----------------------------------*/ |
1171 | |
1172 | enum |
1173 | { |
1174 | THEME_COLUMN, |
1175 | PATH_COLUMN, |
1176 | N_THEME_COLUMNS |
1177 | }; |
1178 | |
1179 | typedef struct |
1180 | { |
1181 | gchar *path; |
1182 | gchar *name; |
1183 | } |
1184 | Theme; |
1185 | |
1186 | static GtkTreeView *theme_treeview; |
1187 | static GtkTreeSelection *theme_selection; |
1188 | |
1189 | static GList *themes_list; |
1190 | static GList *theme_position_in_list; |
1191 | |
1192 | static GtkWidget *theme_alt_spin_button; |
1193 | static GtkWidget *theme_alt_label; |
1194 | static GtkWidget *theme_entry, |
1195 | *author_label; |
1196 | |
1197 | static gboolean theme_modified; |
1198 | |
1199 | |
1200 | typedef struct |
1201 | { |
1202 | GtkFontSelectionDialog *fontseldlg; |
1203 | GtkWidget *entry; |
1204 | GtkWidget *browse_button; |
1205 | gchar *name; |
1206 | gchar *string; |
1207 | // PangoFontDescription *font_desc; |
1208 | } |
1209 | AltFontSelect; |
1210 | |
1211 | static AltFontSelect |
1212 | large_font, |
1213 | normal_font, |
1214 | small_font; |
1215 | |
1216 | gchar * |
1217 | gkrellm_get_large_font_string(void) |
1218 | { |
1219 | return large_font.string; |
1220 | } |
1221 | |
1222 | gchar * |
1223 | gkrellm_get_normal_font_string(void) |
1224 | { |
1225 | return normal_font.string; |
1226 | } |
1227 | |
1228 | gchar * |
1229 | gkrellm_get_small_font_string(void) |
1230 | { |
1231 | return small_font.string; |
1232 | } |
1233 | |
1234 | static gboolean |
1235 | get_font_entries(void) |
1236 | { |
1237 | gchar *s; |
1238 | gboolean modified = FALSE(0); |
1239 | |
1240 | s = (gchar *) gtk_entry_get_text(GTK_ENTRY(large_font.entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (large_font.entry)), ((gtk_entry_get_type ()))))))); |
1241 | modified |= gkrellm_dup_string(&large_font.string, s); |
1242 | s = (gchar *) gtk_entry_get_text(GTK_ENTRY(normal_font.entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (normal_font.entry)), ((gtk_entry_get_type ()))))))); |
1243 | modified |= gkrellm_dup_string(&normal_font.string, s); |
1244 | s = (gchar *) gtk_entry_get_text(GTK_ENTRY(small_font.entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (small_font.entry)), ((gtk_entry_get_type ()))))))); |
1245 | modified |= gkrellm_dup_string(&small_font.string, s); |
1246 | return modified; |
1247 | } |
1248 | |
1249 | static void |
1250 | cb_font_dialog_ok(GtkWidget *w, AltFontSelect *afs) |
1251 | { |
1252 | gchar *fontname; |
1253 | |
1254 | fontname = gtk_font_selection_dialog_get_font_name(afs->fontseldlg); |
1255 | if (fontname) |
1256 | gtk_entry_set_text(GTK_ENTRY(afs->entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (afs->entry)), ((gtk_entry_get_type ())))))), fontname); |
1257 | gtk_widget_destroy(GTK_WIDGET(afs->fontseldlg)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (afs->fontseldlg)), ((gtk_widget_get_type ()))))))); |
1258 | theme_modified = TRUE(!(0)); |
1259 | get_font_entries(); |
1260 | gkrellm_build(); |
1261 | } |
1262 | |
1263 | static void |
1264 | cb_font_dialog(GtkWidget *widget, AltFontSelect *afs) |
1265 | { |
1266 | GtkWidget *w; |
1267 | GtkFontSelectionDialog *fsd; |
1268 | |
1269 | if (afs->fontseldlg) |
1270 | return; |
1271 | w = gtk_font_selection_dialog_new(_(afs->name)dcgettext ("gkrellm", afs->name, 5)); |
1272 | gtk_window_set_wmclass(GTK_WINDOW(w)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (w)), ((gtk_window_get_type ())))))), |
1273 | "Gkrellm_dialog", "Gkrellm"); |
1274 | fsd = GTK_FONT_SELECTION_DIALOG(w)((((GtkFontSelectionDialog*) g_type_check_instance_cast ((GTypeInstance *) ((w)), ((gtk_font_selection_dialog_get_type ())))))); |
1275 | afs->fontseldlg = fsd; |
1276 | gtk_font_selection_dialog_set_font_name(fsd, afs->string); |
1277 | g_signal_connect(G_OBJECT(fsd->ok_button), "clicked",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((fsd->ok_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (cb_font_dialog_ok)) ), (afs), ((void*)0), (GConnectFlags) 0) |
1278 | G_CALLBACK(cb_font_dialog_ok), afs)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((fsd->ok_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (cb_font_dialog_ok)) ), (afs), ((void*)0), (GConnectFlags) 0); |
1279 | g_signal_connect_swapped(G_OBJECT(fsd->cancel_button), "clicked",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((fsd->cancel_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (gtk_widget_destroy ))), (fsd), ((void*)0), G_CONNECT_SWAPPED) |
1280 | G_CALLBACK(gtk_widget_destroy), fsd)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((fsd->cancel_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (gtk_widget_destroy ))), (fsd), ((void*)0), G_CONNECT_SWAPPED); |
1281 | g_signal_connect(G_OBJECT(fsd), "destroy",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((fsd)), (((GType) ((20) << (2)))))) ))), ("destroy"), (((GCallback) (gtk_widget_destroyed))), (& afs->fontseldlg), ((void*)0), (GConnectFlags) 0) |
1282 | G_CALLBACK(gtk_widget_destroyed), &afs->fontseldlg)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((fsd)), (((GType) ((20) << (2)))))) ))), ("destroy"), (((GCallback) (gtk_widget_destroyed))), (& afs->fontseldlg), ((void*)0), (GConnectFlags) 0); |
1283 | gtk_widget_show(GTK_WIDGET(fsd)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (fsd)), ((gtk_widget_get_type ()))))))); |
1284 | } |
1285 | |
1286 | static gchar * |
1287 | get_theme_author(gchar *path) |
1288 | { |
1289 | static gchar buf[128]; |
1290 | FILE *f; |
1291 | gchar *s, *q, *rcfile, line[128]; |
1292 | |
1293 | buf[0] = '\0'; |
1294 | if (!path || *path == '\0') |
1295 | return buf; |
1296 | rcfile = g_strdup_printf("%s/%s", path, GKRELLMRC"gkrellmrc"); |
1297 | f = g_fopenfopen(rcfile, "r"); |
1298 | g_free(rcfile); |
1299 | if (!f) |
1300 | return buf; |
1301 | while (fgets(line, sizeof(line), f)) |
1302 | { |
1303 | if ( (s = strtok(line, " :=\t\n")) == NULL((void*)0) |
1304 | || strcmp(s, "author")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (s) && __builtin_constant_p ("author") && (__s1_len = strlen (s), __s2_len = strlen ("author"), (!((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("author") + 1 ) - (size_t)(const void *)("author") == 1) || __s2_len >= 4 )) ? __builtin_strcmp (s, "author") : (__builtin_constant_p ( s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p ("author") && ((size_t )(const void *)(("author") + 1) - (size_t)(const void *)("author" ) == 1) ? __builtin_strcmp (s, "author") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("author"); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( s))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("author" ) && ((size_t)(const void *)(("author") + 1) - (size_t )(const void *)("author") == 1) && (__s2_len = strlen ("author"), __s2_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (s, "author") : (- (__extension__ ( { const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) ("author"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("author"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("author"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("author"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (s, "author")))); }) != 0 |
1305 | ) |
1306 | continue; |
1307 | s = strtok(NULL((void*)0), "\n"); /* Rest of line is Author string */ |
1308 | if (s) |
1309 | { |
1310 | while ( *s == ' ' || *s == '\t' || *s == '"' || *s == '=' |
1311 | || *s == ':') |
1312 | ++s; |
1313 | q = strchr(s, (int) '"')(__extension__ (__builtin_constant_p ((int) '"') && ! __builtin_constant_p (s) && ((int) '"') == '\0' ? (char *) __rawmemchr (s, (int) '"') : __builtin_strchr (s, (int) '"' ))); |
1314 | if (q) |
1315 | *q = '\0'; |
1316 | strcpy(buf, s); |
1317 | break; |
1318 | } |
1319 | } |
1320 | fclose(f); |
1321 | return buf; |
1322 | } |
1323 | |
1324 | static Theme * |
1325 | find_theme_in_list(gchar *name) |
1326 | { |
1327 | GList *list; |
1328 | Theme *theme; |
1329 | |
1330 | if (!name || !*name) |
1331 | return NULL((void*)0); |
1332 | |
1333 | for (list = themes_list ; list; list = list->next) |
1334 | { |
1335 | theme = (Theme *) list->data; |
1336 | if (!strcmp(theme->name, name)__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (theme->name) && __builtin_constant_p (name) && (__s1_len = strlen (theme->name), __s2_len = strlen (name ), (!((size_t)(const void *)((theme->name) + 1) - (size_t) (const void *)(theme->name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((name) + 1) - (size_t)(const void * )(name) == 1) || __s2_len >= 4)) ? __builtin_strcmp (theme ->name, name) : (__builtin_constant_p (theme->name) && ((size_t)(const void *)((theme->name) + 1) - (size_t)(const void *)(theme->name) == 1) && (__s1_len = strlen ( theme->name), __s1_len < 4) ? (__builtin_constant_p (name ) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (theme->name, name ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (name); int __result = (((const unsigned char *) (const char *) (theme->name))[0] - __s2[0]); if ( __s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (theme->name))[1] - __s2[ 1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (theme->name)) [2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (theme-> name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t )(const void *)(name) == 1) && (__s2_len = strlen (name ), __s2_len < 4) ? (__builtin_constant_p (theme->name) && ((size_t)(const void *)((theme->name) + 1) - (size_t)(const void *)(theme->name) == 1) ? __builtin_strcmp (theme-> name, name) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (theme->name); int __result = (((const unsigned char *) (const char *) (name))[ 0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[ 1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[ 2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2 [3]); } } __result; })))) : __builtin_strcmp (theme->name, name)))); })) |
1337 | return theme; |
1338 | } |
1339 | return NULL((void*)0); |
1340 | } |
1341 | |
1342 | static void |
1343 | add_themes_to_list(gchar *theme_dir, gboolean in_gkrellm2) |
1344 | { |
1345 | GDir *dir; |
1346 | Theme *theme; |
1347 | gchar *name; |
1348 | gchar *path; |
1349 | |
1350 | if ((dir = g_dir_open(theme_dir, 0, NULL((void*)0))) == NULL((void*)0)) |
1351 | return; |
1352 | while ((name = (gchar *) g_dir_read_name(dir)) != NULL((void*)0)) |
1353 | { |
1354 | if (find_theme_in_list(name)) |
1355 | continue; |
1356 | if (in_gkrellm2) |
1357 | path = g_build_filename(theme_dir, name, "gkrellm2", NULL((void*)0)); |
1358 | else |
1359 | path = g_build_filename(theme_dir, name, NULL((void*)0)); |
1360 | |
1361 | if (g_file_test(path, G_FILE_TEST_IS_DIR)) |
1362 | { |
1363 | theme = g_new0(Theme, 1)(Theme *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s = sizeof (Theme); gpointer __p; if (__s == 1) __p = g_malloc0 (__n); else if (__builtin_constant_p (__n) && (__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p ; })); |
1364 | theme->path = path; |
1365 | theme->name = g_strdup(name); |
1366 | themes_list = g_list_append(themes_list, theme); |
1367 | } |
1368 | else |
1369 | g_free(path); |
1370 | } |
1371 | g_dir_close(dir); |
1372 | } |
1373 | |
1374 | static void |
1375 | find_theme_position_in_list(void) |
1376 | { |
1377 | GList *list; |
1378 | Theme *theme; |
1379 | gchar *name; |
1380 | |
1381 | name = *(_GK.theme_path) ? _GK.theme_path : "Default"; |
1382 | for (list = themes_list; list; list = list->next) |
1383 | { |
1384 | theme = (Theme *) list->data; |
1385 | if (!strcmp(name, theme->path)__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p (theme->path) && (__s1_len = strlen (name), __s2_len = strlen (theme->path ), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((theme->path) + 1) - (size_t)(const void *)(theme ->path) == 1) || __s2_len >= 4)) ? __builtin_strcmp (name , theme->path) : (__builtin_constant_p (name) && ( (size_t)(const void *)((name) + 1) - (size_t)(const void *)(name ) == 1) && (__s1_len = strlen (name), __s1_len < 4 ) ? (__builtin_constant_p (theme->path) && ((size_t )(const void *)((theme->path) + 1) - (size_t)(const void * )(theme->path) == 1) ? __builtin_strcmp (name, theme->path ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (theme->path); int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char * ) (const char *) (name))[3] - __s2[3]); } } __result; }))) : ( __builtin_constant_p (theme->path) && ((size_t)(const void *)((theme->path) + 1) - (size_t)(const void *)(theme ->path) == 1) && (__s2_len = strlen (theme->path ), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *) (name) == 1) ? __builtin_strcmp (name, theme->path) : (- ( __extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (name); int __result = (((const unsigned char *) (const char *) (theme->path))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (theme->path))[1] - __s2[1]); if ( __s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (theme->path))[2] - __s2[ 2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (theme->path))[3 ] - __s2[3]); } } __result; })))) : __builtin_strcmp (name, theme ->path)))); })) |
1386 | break; |
1387 | } |
1388 | theme_position_in_list = list ? list : themes_list; |
1389 | } |
1390 | |
1391 | gint |
1392 | theme_compare(Theme *th1, Theme *th2) |
1393 | { |
1394 | return strcmp(th1->name, th2->name)__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (th1->name) && __builtin_constant_p (th2->name ) && (__s1_len = strlen (th1->name), __s2_len = strlen (th2->name), (!((size_t)(const void *)((th1->name) + 1 ) - (size_t)(const void *)(th1->name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((th2->name) + 1) - (size_t)(const void *)(th2->name) == 1) || __s2_len >= 4)) ? __builtin_strcmp (th1->name, th2->name) : (__builtin_constant_p (th1->name) && ((size_t)(const void *)((th1->name ) + 1) - (size_t)(const void *)(th1->name) == 1) && (__s1_len = strlen (th1->name), __s1_len < 4) ? (__builtin_constant_p (th2->name) && ((size_t)(const void *)((th2->name ) + 1) - (size_t)(const void *)(th2->name) == 1) ? __builtin_strcmp (th1->name, th2->name) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (th2-> name); int __result = (((const unsigned char *) (const char * ) (th1->name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (th1->name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (th1->name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (th1->name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (th2->name) && ((size_t)(const void *)((th2->name ) + 1) - (size_t)(const void *)(th2->name) == 1) && (__s2_len = strlen (th2->name), __s2_len < 4) ? (__builtin_constant_p (th1->name) && ((size_t)(const void *)((th1->name ) + 1) - (size_t)(const void *)(th1->name) == 1) ? __builtin_strcmp (th1->name, th2->name) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (th1-> name); int __result = (((const unsigned char *) (const char * ) (th2->name))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (th2->name))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (th2->name))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (th2->name))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (th1->name, th2->name)))); }); |
1395 | } |
1396 | |
1397 | void |
1398 | gkrellm_make_themes_list(void) |
1399 | { |
1400 | GList *list; |
1401 | Theme *theme; |
1402 | gchar *theme_dir; |
1403 | |
1404 | for (list = themes_list; list; list = list->next) |
1405 | { |
1406 | theme = (Theme *) list->data; |
1407 | g_free(theme->path); |
1408 | g_free(theme->name); |
1409 | } |
1410 | gkrellm_free_glist_and_data(&themes_list); |
1411 | |
1412 | theme = g_new0(Theme, 1)(Theme *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s = sizeof (Theme); gpointer __p; if (__s == 1) __p = g_malloc0 (__n); else if (__builtin_constant_p (__n) && (__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p ; })); |
1413 | theme->path = g_strdup("Default"); |
1414 | theme->name = g_strdup(theme->path); |
1415 | themes_list = g_list_append(themes_list, theme); |
1416 | |
1417 | theme_dir = g_build_filename(gkrellm_homedir(), GKRELLM_THEMES_DIR".gkrellm2/themes", NULL((void*)0)); |
1418 | add_themes_to_list(theme_dir, FALSE(0)); |
1419 | g_free(theme_dir); |
1420 | |
1421 | theme_dir = g_build_filename(gkrellm_homedir(), ".themes", NULL((void*)0)); |
1422 | add_themes_to_list(theme_dir, TRUE(!(0))); |
1423 | g_free(theme_dir); |
1424 | |
1425 | theme_dir = gtk_rc_get_theme_dir(); |
1426 | add_themes_to_list(theme_dir, TRUE(!(0))); |
1427 | |
1428 | #if defined(WIN32) |
1429 | gchar *install_path; |
1430 | install_path = g_win32_get_package_installation_directory_of_module(NULL((void*)0)); |
1431 | if (install_path != NULL((void*)0)) |
1432 | { |
1433 | theme_dir = g_build_filename(install_path, "share", "gkrellm2", "themes", NULL((void*)0)); |
1434 | add_themes_to_list(theme_dir, FALSE(0)); |
1435 | g_free(theme_dir); |
1436 | g_free(install_path); |
1437 | } |
1438 | #endif |
1439 | |
1440 | #if defined(LOCAL_THEMES_DIR"/usr/local/share/gkrellm2/themes") |
1441 | add_themes_to_list(LOCAL_THEMES_DIR"/usr/local/share/gkrellm2/themes", FALSE(0)); |
1442 | #endif |
1443 | #if defined(SYSTEM_THEMES_DIR"/usr/share/gkrellm2/themes") |
1444 | add_themes_to_list(SYSTEM_THEMES_DIR"/usr/share/gkrellm2/themes", FALSE(0)); |
1445 | #endif |
1446 | |
1447 | themes_list = g_list_sort(themes_list, (GCompareFunc) theme_compare); |
1448 | |
1449 | if (_GK.command_line_theme) |
1450 | { |
1451 | theme = g_new0(Theme, 1)(Theme *) (__extension__ ({ gsize __n = (gsize) (1); gsize __s = sizeof (Theme); gpointer __p; if (__s == 1) __p = g_malloc0 (__n); else if (__builtin_constant_p (__n) && (__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p ; })); |
1452 | theme->path = g_strdup(_GK.command_line_theme); |
1453 | theme->name = g_strdup(theme->path); |
1454 | themes_list = g_list_append(themes_list, theme); |
1455 | } |
1456 | find_theme_position_in_list(); |
1457 | } |
1458 | |
1459 | static GtkTreeModel * |
1460 | theme_create_model(void) |
1461 | { |
1462 | GtkListStore *store; |
1463 | GtkTreeIter iter; |
1464 | GList *list; |
1465 | Theme *theme; |
1466 | |
1467 | gkrellm_make_themes_list(); |
1468 | store = gtk_list_store_new(N_THEME_COLUMNS, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_STRING((GType) ((16) << (2)))); |
1469 | for (list = themes_list; list; list = list->next) |
1470 | { |
1471 | theme = (Theme *) list->data; |
1472 | gtk_list_store_append(store, &iter); |
1473 | gtk_list_store_set(store, &iter, |
1474 | THEME_COLUMN, theme->name, |
1475 | PATH_COLUMN, theme->path, |
1476 | -1); |
1477 | } |
1478 | return GTK_TREE_MODEL(store)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((gtk_tree_model_get_type ())))))); |
1479 | } |
1480 | |
1481 | static void |
1482 | cb_theme_tree_selection_changed(GtkTreeSelection *selection, gpointer data) |
1483 | { |
1484 | GtkTreeIter iter; |
1485 | GtkTreeModel *model; |
1486 | gchar *path; |
1487 | |
1488 | if (!gtk_tree_selection_get_selected(selection, &model, &iter)) |
1489 | return; |
1490 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(theme_alt_spin_button)((((GtkSpinButton*) g_type_check_instance_cast ((GTypeInstance *) ((theme_alt_spin_button)), ((gtk_spin_button_get_type ())) )))), 0.0); |
1491 | gtk_tree_model_get(model, &iter, PATH_COLUMN, &path, -1); |
1492 | gtk_entry_set_text(GTK_ENTRY(theme_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (theme_entry)), ((gtk_entry_get_type ())))))), path); |
1493 | gtk_label_set_text(GTK_LABEL(author_label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (author_label)), ((gtk_label_get_type ())))))), get_theme_author(path)); |
1494 | if (gkrellm_dup_string(&_GK.theme_path, path)) |
1495 | { |
1496 | find_theme_position_in_list(); |
1497 | theme_modified = TRUE(!(0)); |
1498 | gkrellm_build(); |
1499 | } |
1500 | } |
1501 | |
1502 | static void |
1503 | cb_theme_alternative_changed(GtkWidget *widget, GtkSpinButton *spin) |
1504 | { |
1505 | gint i; |
1506 | |
1507 | i = gtk_spin_button_get_value_as_int(spin); |
1508 | if (i > _GK.theme_n_alternatives) |
1509 | { |
1510 | i = _GK.theme_n_alternatives; |
1511 | gtk_spin_button_set_value(spin, (gfloat) i); |
1512 | } |
1513 | if (i != _GK.theme_alternative) |
1514 | { |
1515 | _GK.theme_alternative = i; |
1516 | theme_modified = TRUE(!(0)); |
1517 | gkrellm_build(); |
1518 | } |
1519 | } |
1520 | |
1521 | static void |
1522 | cb_theme_scale_changed(GtkWidget *widget, GtkSpinButton *spin) |
1523 | { |
1524 | gint i; |
1525 | |
1526 | i = gtk_spin_button_get_value_as_int(spin); |
1527 | if (i != _GK.theme_scale) |
1528 | { |
1529 | _GK.theme_scale = i; |
1530 | theme_modified = TRUE(!(0)); |
1531 | gkrellm_build(); |
1532 | } |
1533 | } |
1534 | |
1535 | void |
1536 | gkrellm_set_theme_alternatives_label(void) |
1537 | { |
1538 | GtkSpinButton *spin; |
1539 | gchar buf[64]; |
1540 | |
1541 | if (!config_window) |
1542 | return; |
1543 | spin = GTK_SPIN_BUTTON(theme_alt_spin_button)((((GtkSpinButton*) g_type_check_instance_cast ((GTypeInstance *) ((theme_alt_spin_button)), ((gtk_spin_button_get_type ())) )))); |
1544 | gtk_spin_button_set_value(spin, (gfloat) _GK.theme_alternative); |
1545 | snprintf(buf, sizeof(buf), _("%d total theme alternatives")dcgettext ("gkrellm", "%d total theme alternatives", 5), |
1546 | _GK.theme_n_alternatives); |
1547 | gtk_label_set_text(GTK_LABEL(theme_alt_label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (theme_alt_label)), ((gtk_label_get_type ())))))), buf); |
1548 | } |
1549 | |
1550 | void |
1551 | gkrellm_save_theme_config(void) |
1552 | { |
1553 | FILE *f; |
1554 | gchar *path; |
1555 | |
1556 | /* Assume gkrellm -t is for testing and don't save theme config changes. |
1557 | | Similary for _GK.demo. |
1558 | */ |
1559 | if (!theme_modified || _GK.command_line_theme || _GK.demo || _GK.no_config) |
1560 | return; |
1561 | |
1562 | path = gkrellm_make_config_file_name(gkrellm_homedir(), |
1563 | GKRELLM_THEME_CONFIG".gkrellm2/theme_config"); |
1564 | |
1565 | if ((f = g_fopenfopen(path, "w")) != NULL((void*)0)) |
1566 | { |
1567 | fprintf(f, "%s\n", _GK.theme_path); |
1568 | fprintf(f, "%d\n", _GK.theme_alternative); |
1569 | fprintf(f, "%s\n", large_font.string); |
1570 | fprintf(f, "%s\n", normal_font.string); |
1571 | fprintf(f, "%s\n", small_font.string); |
1572 | fprintf(f, "%d\n", _GK.theme_scale); |
1573 | fclose(f); |
1574 | } |
1575 | g_free(path); |
1576 | theme_modified = FALSE(0); |
1577 | } |
1578 | |
1579 | void |
1580 | gkrellm_load_theme_config(void) |
1581 | { |
1582 | FILE *f; |
1583 | gchar *path, *s; |
1584 | gchar buf[1024]; |
1585 | gint i; |
1586 | |
1587 | /* Need to load the theme from ~/.gkrellm/theme_config only at startup |
1588 | | or if re-reading because of theme_event - these are only times |
1589 | | _GK.theme_path will be NULL. Note: _GK.theme_path will not be NULL |
1590 | | at startup if there is a command line theme, so no theme scaling if |
1591 | | using command line theme. |
1592 | */ |
1593 | if (!_GK.theme_path) |
1594 | { |
1595 | path = gkrellm_make_config_file_name(gkrellm_homedir(), |
1596 | GKRELLM_THEME_CONFIG".gkrellm2/theme_config"); |
1597 | f = g_fopenfopen(path, "r"); |
1598 | g_free(path); |
1599 | if (f && fgets(buf, sizeof(buf), f)) |
1600 | { |
1601 | if ((s = strchr(buf, (gint) '\n')(__extension__ (__builtin_constant_p ((gint) '\n') && !__builtin_constant_p (buf) && ((gint) '\n') == '\0' ? (char *) __rawmemchr (buf, (gint) '\n') : __builtin_strchr (buf, (gint) '\n')))) != NULL((void*)0)) |
1602 | *s = '\0'; |
1603 | gkrellm_debug(DEBUG_GUI0x2000, "gkrellm_load_theme_config: %s\n", buf); |
1604 | s = buf; |
1605 | if (s && *s != '#' && *s != '\0' && strcmp(s, "Default")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (s) && __builtin_constant_p ("Default") && ( __s1_len = strlen (s), __s2_len = strlen ("Default"), (!((size_t )(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("Default" ) + 1) - (size_t)(const void *)("Default") == 1) || __s2_len >= 4)) ? __builtin_strcmp (s, "Default") : (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) && (__s1_len = strlen (s), __s1_len < 4) ? (__builtin_constant_p ("Default") && ((size_t )(const void *)(("Default") + 1) - (size_t)(const void *)("Default" ) == 1) ? __builtin_strcmp (s, "Default") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("Default"); int __result = (((const unsigned char *) (const char *) (s))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( s))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (s) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (s))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("Default" ) && ((size_t)(const void *)(("Default") + 1) - (size_t )(const void *)("Default") == 1) && (__s2_len = strlen ("Default"), __s2_len < 4) ? (__builtin_constant_p (s) && ((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) ? __builtin_strcmp (s, "Default") : (- (__extension__ ( { const unsigned char *__s2 = (const unsigned char *) (const char *) (s); int __result = (((const unsigned char *) (const char *) ("Default"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("Default"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("Default"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("Default"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (s, "Default")))); })) |
1606 | { |
1607 | if (*s == '/' || s[1] == ':') |
1608 | _GK.theme_path = g_strdup(s); |
1609 | else |
1610 | _GK.theme_path = g_strdup_printf("%s/%s/%s", |
1611 | gkrellm_homedir(), GKRELLM_THEMES_DIR".gkrellm2/themes", s); |
1612 | } |
1613 | for (i = 0; fgets(buf, sizeof(buf), f); ++i) |
1614 | { |
1615 | if ((s = strchr(buf, (gint) '\n')(__extension__ (__builtin_constant_p ((gint) '\n') && !__builtin_constant_p (buf) && ((gint) '\n') == '\0' ? (char *) __rawmemchr (buf, (gint) '\n') : __builtin_strchr (buf, (gint) '\n')))) != NULL((void*)0)) |
1616 | *s = '\0'; |
1617 | gkrellm_debug(DEBUG_GUI0x2000, "gkrellm_load_theme_config: %s\n", buf); |
1618 | if (i == 0) |
1619 | sscanf(buf, "%d", &_GK.theme_alternative); |
1620 | if (i == 1 && !strstr(buf, "*-*")) /* XXX Trap out GdkFont */ |
1621 | gkrellm_dup_string(&large_font.string, buf); |
1622 | if (i == 2 && !strstr(buf, "*-*")) |
1623 | gkrellm_dup_string(&normal_font.string, buf); |
1624 | if (i == 3 && !strstr(buf, "*-*")) |
1625 | gkrellm_dup_string(&small_font.string, buf); |
1626 | if (i == 4) |
1627 | sscanf(buf, "%d", &_GK.theme_scale); |
1628 | } |
1629 | } |
1630 | if (f) |
1631 | fclose(f); |
1632 | } |
1633 | if (!_GK.theme_path || !g_file_test(_GK.theme_path, G_FILE_TEST_IS_DIR)) |
1634 | gkrellm_dup_string(&_GK.theme_path, ""); |
1635 | if (!large_font.string) |
1636 | gkrellm_dup_string(&large_font.string, "Serif 11"); |
1637 | if (!normal_font.string) |
1638 | gkrellm_dup_string(&normal_font.string, "Serif 9"); |
1639 | if (!small_font.string) |
1640 | gkrellm_dup_string(&small_font.string, "Serif 8"); |
1641 | } |
1642 | |
1643 | |
1644 | void |
1645 | gkrellm_read_theme_event(GtkSettings *settings) |
1646 | { |
1647 | Theme *theme; |
1648 | gchar *s, *theme_name = NULL((void*)0); |
1649 | gint alt = 0; |
1650 | |
1651 | if (settings) /* called via "notify::gtk-theme-name" signal connect, */ |
1652 | /* so get the current gtk theme name and switch to it */ |
1653 | { |
1654 | g_object_get(_GK.gtk_settings, "gtk-theme-name", &theme_name, NULL((void*)0)); |
1655 | if (theme_name) |
1656 | gkrellm_debug(DEBUG_GUI0x2000, "notify::gtk-theme-name: %s\n", theme_name); |
1657 | |
1658 | if ( gkrellm_dup_string(&_GK.gtk_theme_name, theme_name) |
1659 | && _GK.track_gtk_theme_name |
1660 | ) |
1661 | { |
1662 | theme = find_theme_in_list(theme_name); |
1663 | if (!theme) |
1664 | { |
1665 | theme_name = g_strdup(_GK.default_track_theme); |
1666 | if ((s = strrchr(theme_name, ':')) != NULL((void*)0)) |
1667 | { |
1668 | *s++ = '\0'; |
1669 | alt = atoi(s); |
1670 | } |
1671 | theme = find_theme_in_list(theme_name); |
1672 | g_free(theme_name); |
1673 | } |
1674 | if ( theme && theme->path |
1675 | && gkrellm_dup_string(&_GK.theme_path, |
1676 | strcmp(theme->path, "Default")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (theme->path) && __builtin_constant_p ("Default") && (__s1_len = strlen (theme->path), __s2_len = strlen ("Default"), (!((size_t)(const void *)((theme->path) + 1) - (size_t)(const void *)(theme->path) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("Default") + 1) - ( size_t)(const void *)("Default") == 1) || __s2_len >= 4)) ? __builtin_strcmp (theme->path, "Default") : (__builtin_constant_p (theme->path) && ((size_t)(const void *)((theme-> path) + 1) - (size_t)(const void *)(theme->path) == 1) && (__s1_len = strlen (theme->path), __s1_len < 4) ? (__builtin_constant_p ("Default") && ((size_t)(const void *)(("Default") + 1) - (size_t)(const void *)("Default") == 1) ? __builtin_strcmp (theme->path, "Default") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("Default" ); int __result = (((const unsigned char *) (const char *) (theme ->path))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( theme->path))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (theme->path))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char * ) (const char *) (theme->path))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("Default") && ((size_t )(const void *)(("Default") + 1) - (size_t)(const void *)("Default" ) == 1) && (__s2_len = strlen ("Default"), __s2_len < 4) ? (__builtin_constant_p (theme->path) && ((size_t )(const void *)((theme->path) + 1) - (size_t)(const void * )(theme->path) == 1) ? __builtin_strcmp (theme->path, "Default" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (theme->path); int __result = (((const unsigned char *) (const char *) ("Default"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("Default"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("Default"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("Default"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (theme->path, "Default" )))); }) ? theme->path : "") |
1677 | ) |
1678 | { |
1679 | _GK.theme_alternative = alt; |
1680 | theme_modified = TRUE(!(0)); |
1681 | gkrellm_save_theme_config(); |
1682 | gkrellm_build(); |
1683 | } |
1684 | } |
1685 | } |
1686 | else /* Called from cb_client_event() because we were sent the */ |
1687 | /* _GKRELLM_READ_THEME client event, so reread theme config. */ |
1688 | { |
1689 | g_free(_GK.theme_path); |
1690 | _GK.theme_path = NULL((void*)0); /* Forces reread of GKRELLM_THEME_CONFIG */ |
1691 | gkrellm_build(); |
1692 | } |
1693 | } |
1694 | |
1695 | static void |
1696 | cb_load_theme(GtkAction *action, GtkWidget *widget) |
1697 | { |
1698 | GtkTreeIter iter; |
1699 | GtkTreeModel *model; |
1700 | GtkTreePath *path; |
1701 | Theme *theme; |
1702 | gint row; |
1703 | const gchar *act = gtk_action_get_name(action); |
1704 | |
1705 | ++_GK.theme_reload_count; |
1706 | if (_GK.no_config) |
1707 | return; |
1708 | if (!themes_list) |
1709 | gkrellm_make_themes_list(); |
1710 | if (strcmp(act, "ThemeAltNextAction")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemeAltNextAction") && (__s1_len = strlen (act), __s2_len = strlen ("ThemeAltNextAction" ), (!((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemeAltNextAction") + 1) - (size_t)(const void *) ("ThemeAltNextAction") == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemeAltNextAction") : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)( act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemeAltNextAction") && ((size_t)(const void *)(("ThemeAltNextAction") + 1) - (size_t )(const void *)("ThemeAltNextAction") == 1) ? __builtin_strcmp (act, "ThemeAltNextAction") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemeAltNextAction" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemeAltNextAction" ) && ((size_t)(const void *)(("ThemeAltNextAction") + 1) - (size_t)(const void *)("ThemeAltNextAction") == 1) && (__s2_len = strlen ("ThemeAltNextAction"), __s2_len < 4) ? (__builtin_constant_p (act) && ((size_t)(const void * )((act) + 1) - (size_t)(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemeAltNextAction") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[0] - __s2[0]); if (__s2_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemeAltNextAction")))); }) == 0 || strcmp(act, "ThemeAltPrevAction")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemeAltPrevAction") && (__s1_len = strlen (act), __s2_len = strlen ("ThemeAltPrevAction" ), (!((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemeAltPrevAction") + 1) - (size_t)(const void *) ("ThemeAltPrevAction") == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemeAltPrevAction") : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)( act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemeAltPrevAction") && ((size_t)(const void *)(("ThemeAltPrevAction") + 1) - (size_t )(const void *)("ThemeAltPrevAction") == 1) ? __builtin_strcmp (act, "ThemeAltPrevAction") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemeAltPrevAction" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemeAltPrevAction" ) && ((size_t)(const void *)(("ThemeAltPrevAction") + 1) - (size_t)(const void *)("ThemeAltPrevAction") == 1) && (__s2_len = strlen ("ThemeAltPrevAction"), __s2_len < 4) ? (__builtin_constant_p (act) && ((size_t)(const void * )((act) + 1) - (size_t)(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemeAltPrevAction") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemeAltPrevAction" ))[0] - __s2[0]); if (__s2_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeAltPrevAction" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeAltPrevAction" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("ThemeAltPrevAction" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemeAltPrevAction")))); }) == 0) |
1711 | { |
1712 | _GK.theme_alternative += ((strcmp(act, "ThemeAltNextAction")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemeAltNextAction") && (__s1_len = strlen (act), __s2_len = strlen ("ThemeAltNextAction" ), (!((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemeAltNextAction") + 1) - (size_t)(const void *) ("ThemeAltNextAction") == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemeAltNextAction") : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)( act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemeAltNextAction") && ((size_t)(const void *)(("ThemeAltNextAction") + 1) - (size_t )(const void *)("ThemeAltNextAction") == 1) ? __builtin_strcmp (act, "ThemeAltNextAction") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemeAltNextAction" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemeAltNextAction" ) && ((size_t)(const void *)(("ThemeAltNextAction") + 1) - (size_t)(const void *)("ThemeAltNextAction") == 1) && (__s2_len = strlen ("ThemeAltNextAction"), __s2_len < 4) ? (__builtin_constant_p (act) && ((size_t)(const void * )((act) + 1) - (size_t)(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemeAltNextAction") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[0] - __s2[0]); if (__s2_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("ThemeAltNextAction" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemeAltNextAction")))); }) == 0) ? 1 : -1); |
1713 | if (_GK.theme_alternative > _GK.theme_n_alternatives) |
1714 | { |
1715 | _GK.theme_alternative = 0; |
1716 | act = "ThemeNextAction"; |
1717 | } |
1718 | if (_GK.theme_alternative < 0) |
1719 | { |
1720 | _GK.theme_alternative = 100; |
1721 | act = "ThemePrevAction"; |
1722 | } |
1723 | theme_modified = TRUE(!(0)); |
1724 | } |
1725 | |
1726 | if (strcmp(act, "ThemeNextAction")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemeNextAction") && (__s1_len = strlen (act), __s2_len = strlen ("ThemeNextAction" ), (!((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemeNextAction") + 1) - (size_t)(const void *)("ThemeNextAction" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemeNextAction" ) : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemeNextAction") && ((size_t)(const void *)(("ThemeNextAction" ) + 1) - (size_t)(const void *)("ThemeNextAction") == 1) ? __builtin_strcmp (act, "ThemeNextAction") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemeNextAction" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemeNextAction" ) && ((size_t)(const void *)(("ThemeNextAction") + 1) - (size_t)(const void *)("ThemeNextAction") == 1) && (__s2_len = strlen ("ThemeNextAction"), __s2_len < 4) ? ( __builtin_constant_p (act) && ((size_t)(const void *) ((act) + 1) - (size_t)(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemeNextAction") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[0] - __s2[0]); if (__s2_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemeNextAction")))); }) == 0 || strcmp(act, "ThemePrevAction")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemePrevAction") && (__s1_len = strlen (act), __s2_len = strlen ("ThemePrevAction" ), (!((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemePrevAction") + 1) - (size_t)(const void *)("ThemePrevAction" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemePrevAction" ) : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemePrevAction") && ((size_t)(const void *)(("ThemePrevAction" ) + 1) - (size_t)(const void *)("ThemePrevAction") == 1) ? __builtin_strcmp (act, "ThemePrevAction") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemePrevAction" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemePrevAction" ) && ((size_t)(const void *)(("ThemePrevAction") + 1) - (size_t)(const void *)("ThemePrevAction") == 1) && (__s2_len = strlen ("ThemePrevAction"), __s2_len < 4) ? ( __builtin_constant_p (act) && ((size_t)(const void *) ((act) + 1) - (size_t)(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemePrevAction") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemePrevAction" ))[0] - __s2[0]); if (__s2_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemePrevAction" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemePrevAction" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("ThemePrevAction" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemePrevAction")))); }) == 0) |
1727 | { |
1728 | _GK.theme_alternative = 0; |
1729 | if (strcmp(act, "ThemeNextAction")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemeNextAction") && (__s1_len = strlen (act), __s2_len = strlen ("ThemeNextAction" ), (!((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemeNextAction") + 1) - (size_t)(const void *)("ThemeNextAction" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemeNextAction" ) : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemeNextAction") && ((size_t)(const void *)(("ThemeNextAction" ) + 1) - (size_t)(const void *)("ThemeNextAction") == 1) ? __builtin_strcmp (act, "ThemeNextAction") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemeNextAction" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemeNextAction" ) && ((size_t)(const void *)(("ThemeNextAction") + 1) - (size_t)(const void *)("ThemeNextAction") == 1) && (__s2_len = strlen ("ThemeNextAction"), __s2_len < 4) ? ( __builtin_constant_p (act) && ((size_t)(const void *) ((act) + 1) - (size_t)(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemeNextAction") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[0] - __s2[0]); if (__s2_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("ThemeNextAction" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemeNextAction")))); }) == 0) |
1730 | { |
1731 | theme_position_in_list = theme_position_in_list->next; |
1732 | if (!theme_position_in_list) |
1733 | theme_position_in_list = themes_list; |
1734 | } |
1735 | else |
1736 | { |
1737 | theme_position_in_list = theme_position_in_list->prev; |
1738 | if (!theme_position_in_list) |
1739 | theme_position_in_list = g_list_last(themes_list); |
1740 | } |
1741 | if (config_window) |
1742 | { |
1743 | row = g_list_position(themes_list, theme_position_in_list); |
1744 | model = gtk_tree_view_get_model(theme_treeview); |
1745 | gtk_tree_model_iter_nth_child(model, &iter, NULL((void*)0), row); |
1746 | path = gtk_tree_model_get_path(model, &iter); |
1747 | gtk_tree_view_set_cursor(theme_treeview, path, NULL((void*)0), FALSE(0)); |
1748 | return; /* cb_theme_tree_selection_changed -> gkrellm_build()*/ |
1749 | } |
1750 | theme = (Theme *) theme_position_in_list->data; |
1751 | gkrellm_dup_string(&_GK.theme_path, |
1752 | strcmp(theme->path, "Default")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (theme->path) && __builtin_constant_p ("Default") && (__s1_len = strlen (theme->path), __s2_len = strlen ("Default"), (!((size_t)(const void *)((theme->path) + 1) - (size_t)(const void *)(theme->path) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("Default") + 1) - ( size_t)(const void *)("Default") == 1) || __s2_len >= 4)) ? __builtin_strcmp (theme->path, "Default") : (__builtin_constant_p (theme->path) && ((size_t)(const void *)((theme-> path) + 1) - (size_t)(const void *)(theme->path) == 1) && (__s1_len = strlen (theme->path), __s1_len < 4) ? (__builtin_constant_p ("Default") && ((size_t)(const void *)(("Default") + 1) - (size_t)(const void *)("Default") == 1) ? __builtin_strcmp (theme->path, "Default") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("Default" ); int __result = (((const unsigned char *) (const char *) (theme ->path))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( theme->path))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (theme->path))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char * ) (const char *) (theme->path))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("Default") && ((size_t )(const void *)(("Default") + 1) - (size_t)(const void *)("Default" ) == 1) && (__s2_len = strlen ("Default"), __s2_len < 4) ? (__builtin_constant_p (theme->path) && ((size_t )(const void *)((theme->path) + 1) - (size_t)(const void * )(theme->path) == 1) ? __builtin_strcmp (theme->path, "Default" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (theme->path); int __result = (((const unsigned char *) (const char *) ("Default"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("Default"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("Default"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("Default"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (theme->path, "Default" )))); }) ? theme->path : ""); |
1753 | theme_modified = TRUE(!(0)); |
1754 | } |
1755 | if (strcmp(act, "ThemeScaleUp")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemeScaleUp") && (__s1_len = strlen (act), __s2_len = strlen ("ThemeScaleUp") , (!((size_t)(const void *)((act) + 1) - (size_t)(const void * )(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemeScaleUp") + 1) - (size_t)(const void *)("ThemeScaleUp" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemeScaleUp" ) : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemeScaleUp") && ((size_t)(const void *)(("ThemeScaleUp" ) + 1) - (size_t)(const void *)("ThemeScaleUp") == 1) ? __builtin_strcmp (act, "ThemeScaleUp") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemeScaleUp" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemeScaleUp" ) && ((size_t)(const void *)(("ThemeScaleUp") + 1) - ( size_t)(const void *)("ThemeScaleUp") == 1) && (__s2_len = strlen ("ThemeScaleUp"), __s2_len < 4) ? (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t )(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemeScaleUp" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemeScaleUp"))[0] - __s2[0]); if ( __s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("ThemeScaleUp"))[1] - __s2[ 1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("ThemeScaleUp")) [2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("ThemeScaleUp" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemeScaleUp")))); }) == 0 && _GK.theme_scale < 380) |
1756 | { |
1757 | _GK.theme_scale += 20; |
1758 | theme_modified = TRUE(!(0)); |
1759 | } |
1760 | else if (strcmp(act, "ThemeScaleDn")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (act) && __builtin_constant_p ("ThemeScaleDn") && (__s1_len = strlen (act), __s2_len = strlen ("ThemeScaleDn") , (!((size_t)(const void *)((act) + 1) - (size_t)(const void * )(act) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("ThemeScaleDn") + 1) - (size_t)(const void *)("ThemeScaleDn" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (act, "ThemeScaleDn" ) : (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t)(const void *)(act) == 1) && (__s1_len = strlen (act), __s1_len < 4) ? (__builtin_constant_p ("ThemeScaleDn") && ((size_t)(const void *)(("ThemeScaleDn" ) + 1) - (size_t)(const void *)("ThemeScaleDn") == 1) ? __builtin_strcmp (act, "ThemeScaleDn") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("ThemeScaleDn" ); int __result = (((const unsigned char *) (const char *) (act ))[0] - __s2[0]); if (__s1_len > 0 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[1] - __s2[1]); if (__s1_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) (act) )[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (act))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("ThemeScaleDn" ) && ((size_t)(const void *)(("ThemeScaleDn") + 1) - ( size_t)(const void *)("ThemeScaleDn") == 1) && (__s2_len = strlen ("ThemeScaleDn"), __s2_len < 4) ? (__builtin_constant_p (act) && ((size_t)(const void *)((act) + 1) - (size_t )(const void *)(act) == 1) ? __builtin_strcmp (act, "ThemeScaleDn" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (act); int __result = (((const unsigned char *) (const char *) ("ThemeScaleDn"))[0] - __s2[0]); if ( __s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("ThemeScaleDn"))[1] - __s2[ 1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("ThemeScaleDn")) [2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("ThemeScaleDn" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (act , "ThemeScaleDn")))); }) == 0 && _GK.theme_scale > 50) |
1761 | { |
1762 | _GK.theme_scale -= 20; |
1763 | theme_modified = TRUE(!(0)); |
1764 | } |
1765 | gkrellm_build(); |
1766 | } |
1767 | |
1768 | static void |
1769 | destroy_font_dialogs(void) |
1770 | { |
1771 | if (large_font.fontseldlg) |
1772 | gtk_widget_destroy(GTK_WIDGET(large_font.fontseldlg)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (large_font.fontseldlg)), ((gtk_widget_get_type ()))))))); |
1773 | if (normal_font.fontseldlg) |
1774 | gtk_widget_destroy(GTK_WIDGET(normal_font.fontseldlg)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (normal_font.fontseldlg)), ((gtk_widget_get_type ()))))))); |
1775 | if (small_font.fontseldlg) |
1776 | gtk_widget_destroy(GTK_WIDGET(small_font.fontseldlg)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (small_font.fontseldlg)), ((gtk_widget_get_type ()))))))); |
1777 | } |
1778 | |
1779 | static void |
1780 | close_theme_config(gint from_close) |
1781 | { |
1782 | destroy_font_dialogs(); |
1783 | } |
1784 | |
1785 | static void |
1786 | cb_font_entry_activate(GtkWidget *widget, gpointer *data) |
1787 | { |
1788 | if (!get_font_entries()) |
1789 | return; |
1790 | theme_modified = TRUE(!(0)); |
1791 | gkrellm_build(); |
1792 | } |
1793 | |
1794 | static void |
1795 | cb_font_entry_changed(GtkWidget *widget, gpointer *data) |
1796 | { |
1797 | theme_modified = TRUE(!(0)); |
1798 | } |
1799 | |
1800 | gfloat |
1801 | gkrellm_get_theme_scale(void) |
1802 | { |
1803 | return (gfloat) (_GK.theme_scale) / 100.0; |
1804 | } |
1805 | |
1806 | #ifndef WIN32 |
1807 | static void |
1808 | cb_track_gtk(GtkToggleButton *button, GtkWidget *box) |
1809 | { |
1810 | _GK.track_gtk_theme_name = button->active; |
1811 | gtk_widget_set_sensitive(box, _GK.track_gtk_theme_name); |
1812 | } |
1813 | |
1814 | static void |
1815 | cb_track_entry_changed(GtkWidget *widget, gpointer *data) |
1816 | { |
1817 | gchar *s; |
1818 | |
1819 | s = gkrellm_gtk_entry_get_text(&widget); |
1820 | gkrellm_dup_string(&_GK.default_track_theme, s); |
1821 | gkrellm_config_modified(); |
1822 | } |
1823 | #endif // !WIN32 |
1824 | |
1825 | static void |
1826 | create_theme_tab(GtkWidget *tabs_vbox) |
1827 | { |
1828 | GtkWidget *tabs; |
1829 | GtkWidget *vbox, *vbox1, *vbox2, *hbox; |
1830 | GtkWidget *label; |
1831 | #if !defined(WIN32) |
1832 | GtkWidget *entry; |
1833 | #endif // !WIN32 |
1834 | GtkWidget *scrolled; |
1835 | GtkTreeModel *model; |
1836 | GtkCellRenderer *renderer; |
1837 | gchar *s; |
1838 | |
1839 | tabs = gtk_notebook_new(); |
1840 | gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance* ) ((tabs)), ((gtk_notebook_get_type ())))))), GTK_POS_TOP); |
1841 | gtk_box_pack_start(GTK_BOX(tabs_vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((tabs_vbox )), ((gtk_box_get_type ())))))), tabs, TRUE(!(0)), TRUE(!(0)), 0); |
1842 | |
1843 | /* --Theme tab */ |
1844 | vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Theme")dcgettext ("gkrellm", "Theme", 5)); |
1845 | |
1846 | hbox = gtk_hbox_new (FALSE(0), 0); |
1847 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 0); |
1848 | label = gtk_label_new(_("Theme:")dcgettext ("gkrellm", "Theme:", 5)); |
1849 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 3); |
1850 | theme_entry = gtk_entry_new(); |
1851 | gtk_entry_set_max_length(GTK_ENTRY(theme_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (theme_entry)), ((gtk_entry_get_type ())))))), 128); |
1852 | if (_GK.theme_path) |
1853 | gtk_entry_set_text(GTK_ENTRY(theme_entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (theme_entry)), ((gtk_entry_get_type ())))))), _GK.theme_path); |
1854 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), theme_entry, TRUE(!(0)), TRUE(!(0)),0); |
1855 | |
1856 | hbox = gtk_hbox_new (FALSE(0), 0); |
1857 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 0); |
1858 | label = gtk_label_new(_("Author:")dcgettext ("gkrellm", "Author:", 5)); |
1859 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 3); |
1860 | author_label = gtk_label_new(get_theme_author(_GK.theme_path)); |
1861 | gtk_misc_set_alignment(GTK_MISC(author_label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( author_label)), ((gtk_misc_get_type ())))))), 0, 0.5); |
1862 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), author_label, TRUE(!(0)), TRUE(!(0)), 5); |
1863 | |
1864 | vbox1 = gkrellm_gtk_framed_vbox(vbox, NULL((void*)0), 4, TRUE(!(0)), 0, 2); |
1865 | scrolled = gtk_scrolled_window_new(NULL((void*)0), NULL((void*)0)); |
1866 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled)((((GtkScrolledWindow*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_scrolled_window_get_type ())))))), |
1867 | GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
1868 | gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1 )), ((gtk_box_get_type ())))))), scrolled, TRUE(!(0)), TRUE(!(0)), 0); |
1869 | |
1870 | model = theme_create_model(); |
1871 | theme_treeview = GTK_TREE_VIEW(gtk_tree_view_new_with_model(model))((((GtkTreeView*) g_type_check_instance_cast ((GTypeInstance* ) ((gtk_tree_view_new_with_model(model))), ((gtk_tree_view_get_type ())))))); |
1872 | g_object_unref(G_OBJECT(model)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) (( model)), (((GType) ((20) << (2))))))))); |
1873 | gtk_tree_view_set_rules_hint(theme_treeview, TRUE(!(0))); |
1874 | renderer = gtk_cell_renderer_text_new(); |
1875 | gtk_tree_view_insert_column_with_attributes(theme_treeview, -1, |
1876 | _("Theme")dcgettext ("gkrellm", "Theme", 5), renderer, |
1877 | "text", THEME_COLUMN, NULL((void*)0)); |
1878 | gtk_container_add(GTK_CONTAINER(scrolled)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_container_get_type ())))))), GTK_WIDGET(theme_treeview)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (theme_treeview)), ((gtk_widget_get_type ()))))))); |
1879 | theme_selection = gtk_tree_view_get_selection(theme_treeview); |
1880 | gtk_tree_selection_set_mode(theme_selection, GTK_SELECTION_SINGLE); |
1881 | g_signal_connect(G_OBJECT(theme_selection), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((theme_selection)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_theme_tree_selection_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1882 | G_CALLBACK(cb_theme_tree_selection_changed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((theme_selection)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_theme_tree_selection_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1883 | |
1884 | hbox = gtk_hbox_new (FALSE(0), 0); |
1885 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 2); |
1886 | gkrellm_gtk_spin_button(hbox, &theme_alt_spin_button, |
1887 | (gfloat)_GK.theme_alternative, 0.0, 100.0, 1.0, 5.0, 0, 60, |
1888 | cb_theme_alternative_changed, NULL((void*)0), FALSE(0), NULL((void*)0)); |
1889 | theme_alt_label = gtk_label_new(""); |
1890 | gtk_box_pack_start (GTK_BOX (hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), theme_alt_label, TRUE(!(0)), TRUE(!(0)), 4); |
1891 | gtk_misc_set_alignment(GTK_MISC(theme_alt_label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( theme_alt_label)), ((gtk_misc_get_type ())))))), 0, 0.5); |
1892 | gkrellm_set_theme_alternatives_label(); |
1893 | |
1894 | |
1895 | /* -- Options tab */ |
1896 | vbox = gkrellm_gtk_notebook_page(tabs, _("Options")dcgettext ("gkrellm", "Options", 5)); |
1897 | vbox = gkrellm_gtk_framed_vbox(vbox, NULL((void*)0), 2, TRUE(!(0)), 10, 4); |
1898 | |
1899 | #if !defined(WIN32) |
1900 | vbox1 = gtk_vbox_new(FALSE(0), 0); |
1901 | gkrellm_gtk_check_button_connected(vbox, &track_gtk_button, |
1902 | _GK.track_gtk_theme_name, FALSE(0), FALSE(0), 0, |
1903 | cb_track_gtk, vbox1, |
1904 | _("Track Gtk theme changes for similarly named themes")dcgettext ("gkrellm", "Track Gtk theme changes for similarly named themes" , 5)); |
1905 | gtk_widget_set_sensitive(vbox1, _GK.track_gtk_theme_name); |
1906 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), vbox1, FALSE(0), FALSE(0), 0); |
1907 | |
1908 | vbox1 = gkrellm_gtk_category_vbox(vbox1, NULL((void*)0), 0, 0, TRUE(!(0))); |
1909 | hbox = gtk_hbox_new(FALSE(0), 0); |
1910 | gtk_box_pack_start(GTK_BOX(vbox1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox1 )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 0); |
1911 | label = gtk_label_new(_("Default")dcgettext ("gkrellm", "Default", 5)); |
1912 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
1913 | entry = gtk_entry_new(); |
1914 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), entry, TRUE(!(0)), TRUE(!(0)), 0); |
1915 | gtk_entry_set_text(GTK_ENTRY(entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (entry)), ((gtk_entry_get_type ())))))), _GK.default_track_theme); |
1916 | g_signal_connect(G_OBJECT(entry), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((entry)), (((GType) ((20) << (2)))) ))))), ("changed"), (((GCallback) (cb_track_entry_changed))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1917 | G_CALLBACK(cb_track_entry_changed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((entry)), (((GType) ((20) << (2)))) ))))), ("changed"), (((GCallback) (cb_track_entry_changed))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1918 | |
1919 | #endif // !WIN32 |
1920 | |
1921 | hbox = gtk_hbox_new (FALSE(0), 0); |
1922 | gtk_box_pack_end(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 2); |
1923 | gkrellm_gtk_spin_button(hbox, NULL((void*)0), |
1924 | (gfloat)_GK.theme_scale, 40.0, 400.0, 10.0, 20.0, 0, 60, |
1925 | cb_theme_scale_changed, NULL((void*)0), FALSE(0), NULL((void*)0)); |
1926 | label = gtk_label_new(_("Scale")dcgettext ("gkrellm", "Scale", 5)); |
1927 | gtk_box_pack_start (GTK_BOX (hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), label, TRUE(!(0)), TRUE(!(0)), 4); |
1928 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 0, 0.5); |
1929 | |
1930 | |
1931 | /* --Fonts tab */ |
1932 | vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Fonts")dcgettext ("gkrellm", "Fonts", 5)); |
1933 | vbox1 = gkrellm_gtk_framed_vbox(vbox, NULL((void*)0), 2, FALSE(0), 0, 2); |
1934 | |
1935 | vbox2 = gkrellm_gtk_framed_vbox(vbox1, _("Large font")dcgettext ("gkrellm", "Large font", 5), 4, FALSE(0), 0, 3); |
1936 | hbox = gtk_hbox_new(FALSE(0), 0); |
1937 | gtk_box_pack_start(GTK_BOX(vbox2)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox2 )), ((gtk_box_get_type ())))))), hbox, FALSE(0), TRUE(!(0)), 0); |
1938 | |
1939 | large_font.entry = gtk_entry_new(); |
1940 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), large_font.entry, TRUE(!(0)), TRUE(!(0)), 0); |
1941 | gtk_entry_set_text(GTK_ENTRY(large_font.entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (large_font.entry)), ((gtk_entry_get_type ())))))), large_font.string); |
1942 | g_signal_connect(G_OBJECT(large_font.entry), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((large_font.entry)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_font_entry_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1943 | G_CALLBACK(cb_font_entry_changed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((large_font.entry)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_font_entry_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1944 | g_signal_connect(G_OBJECT(large_font.entry), "activate",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((large_font.entry)), (((GType) ((20) << (2))))))))), ("activate"), (((GCallback) (cb_font_entry_activate ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1945 | G_CALLBACK(cb_font_entry_activate), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((large_font.entry)), (((GType) ((20) << (2))))))))), ("activate"), (((GCallback) (cb_font_entry_activate ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1946 | gkrellm_gtk_button_connected(hbox, &large_font.browse_button, FALSE(0), FALSE(0), |
1947 | 0, cb_font_dialog, &large_font, _("Browse")dcgettext ("gkrellm", "Browse", 5)); |
1948 | |
1949 | vbox2 = gkrellm_gtk_framed_vbox(vbox1, _("Normal font")dcgettext ("gkrellm", "Normal font", 5), 4, FALSE(0), 0, 3); |
1950 | hbox = gtk_hbox_new(FALSE(0), 0); |
1951 | gtk_box_pack_start(GTK_BOX(vbox2)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox2 )), ((gtk_box_get_type ())))))), hbox, FALSE(0), TRUE(!(0)), 0); |
1952 | normal_font.entry = gtk_entry_new(); |
1953 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), normal_font.entry, TRUE(!(0)), TRUE(!(0)), 0); |
1954 | gtk_entry_set_text(GTK_ENTRY(normal_font.entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (normal_font.entry)), ((gtk_entry_get_type ())))))), normal_font.string); |
1955 | g_signal_connect(G_OBJECT(normal_font.entry), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((normal_font.entry)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_font_entry_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1956 | G_CALLBACK(cb_font_entry_changed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((normal_font.entry)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_font_entry_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1957 | g_signal_connect(G_OBJECT(normal_font.entry), "activate",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((normal_font.entry)), (((GType) ((20) << (2))))))))), ("activate"), (((GCallback) (cb_font_entry_activate ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1958 | G_CALLBACK(cb_font_entry_activate), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((normal_font.entry)), (((GType) ((20) << (2))))))))), ("activate"), (((GCallback) (cb_font_entry_activate ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1959 | gkrellm_gtk_button_connected(hbox, &normal_font.browse_button, |
1960 | FALSE(0), FALSE(0), 0, cb_font_dialog, &normal_font, |
1961 | _("Browse")dcgettext ("gkrellm", "Browse", 5)); |
1962 | |
1963 | vbox2 = gkrellm_gtk_framed_vbox(vbox1, _("Small font")dcgettext ("gkrellm", "Small font", 5), 4, FALSE(0), 0, 3); |
1964 | hbox = gtk_hbox_new(FALSE(0), 0); |
1965 | gtk_box_pack_start(GTK_BOX(vbox2)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox2 )), ((gtk_box_get_type ())))))), hbox, FALSE(0), TRUE(!(0)), 0); |
1966 | small_font.entry = gtk_entry_new(); |
1967 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), small_font.entry, TRUE(!(0)), TRUE(!(0)), 0); |
1968 | gtk_entry_set_text(GTK_ENTRY(small_font.entry)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) ( (small_font.entry)), ((gtk_entry_get_type ())))))), small_font.string); |
1969 | g_signal_connect(G_OBJECT(small_font.entry), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((small_font.entry)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_font_entry_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1970 | G_CALLBACK(cb_font_entry_changed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((small_font.entry)), (((GType) ((20) << (2))))))))), ("changed"), (((GCallback) (cb_font_entry_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1971 | g_signal_connect(G_OBJECT(small_font.entry), "activate",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((small_font.entry)), (((GType) ((20) << (2))))))))), ("activate"), (((GCallback) (cb_font_entry_activate ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
1972 | G_CALLBACK(cb_font_entry_activate), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((small_font.entry)), (((GType) ((20) << (2))))))))), ("activate"), (((GCallback) (cb_font_entry_activate ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
1973 | gkrellm_gtk_button_connected(hbox, &small_font.browse_button, FALSE(0), FALSE(0), |
1974 | 0, cb_font_dialog, &small_font, _("Browse")dcgettext ("gkrellm", "Browse", 5)); |
1975 | |
1976 | /* --Info tab*/ |
1977 | vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Info")dcgettext ("gkrellm", "Info", 5)); |
1978 | s = g_strdup_printf(_("Untar your theme tar files in %s/%s")dcgettext ("gkrellm", "Untar your theme tar files in %s/%s", 5 ), |
1979 | gkrellm_homedir(), GKRELLM_THEMES_DIR".gkrellm2/themes"); |
1980 | label = gtk_label_new(s); |
1981 | gtk_label_set_justify(GTK_LABEL(label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (label)), ((gtk_label_get_type ())))))), GTK_JUSTIFY_LEFT); |
1982 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 0, 0.5); |
1983 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
1984 | g_free(s); |
1985 | |
1986 | label = gtk_label_new( |
1987 | _("Download themes from the GKrellM theme site at www.muhri.net")dcgettext ("gkrellm", "Download themes from the GKrellM theme site at www.muhri.net" , 5)); |
1988 | gtk_box_pack_start(GTK_BOX(vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((vbox )), ((gtk_box_get_type ())))))), label, FALSE(0), FALSE(0), 0); |
1989 | gtk_label_set_justify(GTK_LABEL(label)((((GtkLabel*) g_type_check_instance_cast ((GTypeInstance*) ( (label)), ((gtk_label_get_type ())))))), GTK_JUSTIFY_LEFT); |
1990 | gtk_misc_set_alignment(GTK_MISC(label)((((GtkMisc*) g_type_check_instance_cast ((GTypeInstance*) (( label)), ((gtk_misc_get_type ())))))), 0, 0.5); |
1991 | |
1992 | |
1993 | } |
1994 | |
1995 | |
1996 | /* ================================================================ */ |
1997 | /* A simple tree store model for selecting monitor configs. |
1998 | */ |
1999 | enum |
2000 | { |
2001 | NAME_COLUMN, |
2002 | MONITOR_COLUMN, |
2003 | PAGE_COLUMN, |
2004 | N_COLUMNS |
2005 | }; |
2006 | |
2007 | static GtkNotebook *config_notebook; |
2008 | |
2009 | static gboolean expand_builtins, |
2010 | expand_plugins; |
2011 | |
2012 | static GtkTreeView *treeview; |
2013 | static GtkTreeStore *model; |
2014 | |
2015 | static GtkWidget *apply_button, |
2016 | *close_button; |
2017 | |
2018 | static GkrellmMonitor *selected_monitor; |
2019 | |
2020 | static void |
2021 | close_config(gpointer data) |
2022 | { |
2023 | GtkTreePath *path; |
2024 | gint from_close = GPOINTER_TO_INT(data)((gint) (glong) (data)); |
2025 | |
2026 | path = gtk_tree_path_new_from_string("1"); |
2027 | expand_builtins = gtk_tree_view_row_expanded(treeview, path); |
2028 | gtk_tree_path_free(path); |
2029 | |
2030 | path = gtk_tree_path_new_from_string("2"); |
2031 | expand_plugins = gtk_tree_view_row_expanded(treeview, path); |
2032 | gtk_tree_path_free(path); |
2033 | |
2034 | g_object_unref(G_OBJECT(model)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) (( model)), (((GType) ((20) << (2))))))))); |
2035 | gtk_widget_destroy(config_window); |
2036 | config_window = NULL((void*)0); |
2037 | |
2038 | gkrellm_plugins_config_close(); |
2039 | close_theme_config(from_close); |
2040 | if (_GK.config_modified) |
2041 | gkrellm_save_user_config(); |
2042 | gkrellm_save_theme_config(); |
2043 | } |
2044 | |
2045 | |
2046 | static void |
2047 | apply_config(void) |
2048 | { |
2049 | GList *list; |
2050 | GkrellmMonitor *mon; |
2051 | |
2052 | gkrellm_freeze_side_frame_packing(); |
2053 | for (list = gkrellm_monitor_list; list; list = list->next) |
2054 | { |
2055 | mon = (GkrellmMonitor *) list->data; |
2056 | if ( mon->apply_config && mon->privat->enabled |
2057 | && (mon->privat->config_created || !mon->create_config) |
2058 | ) |
2059 | { |
2060 | gkrellm_record_state(APPLY_CONFIG, mon); |
2061 | (*(mon->apply_config))(); |
2062 | gkrellm_record_state(INTERNAL, NULL((void*)0)); |
2063 | } |
2064 | } |
2065 | gkrellm_thaw_side_frame_packing(); |
2066 | gkrellm_config_modified(); |
2067 | } |
2068 | |
2069 | static void |
2070 | OK_config(void) |
2071 | { |
2072 | apply_config(); |
2073 | close_config(GINT_TO_POINTER(0)((gpointer) (glong) (0))); |
2074 | } |
2075 | |
2076 | |
2077 | static GtkWidget * |
2078 | create_config_page(GkrellmMonitor *mon, GtkTreeStore *tree, GtkTreeIter *iter, |
2079 | GtkNotebook *notebook) |
2080 | { |
2081 | GtkWidget *vbox; |
2082 | gint page; |
2083 | |
2084 | vbox = gtk_vbox_new(FALSE(0), 0); |
2085 | gtk_notebook_append_page(notebook, vbox, NULL((void*)0)); |
2086 | page = g_list_length(notebook->children) - 1; |
2087 | |
2088 | if (mon) |
2089 | mon->privat->config_page = page; |
2090 | |
2091 | gtk_tree_store_set(tree, iter, |
2092 | MONITOR_COLUMN, mon, |
2093 | PAGE_COLUMN, page, |
2094 | -1); |
2095 | |
2096 | gkrellm_debug(DEBUG_GUI0x2000, "create_config_page %d: %s\n", page, |
2097 | mon ? mon->name : "--"); |
2098 | |
2099 | return vbox; |
2100 | } |
2101 | |
2102 | static void |
2103 | real_create_config(GkrellmMonitor *mon) |
2104 | { |
2105 | if (mon->privat->config_created || !mon->create_config) |
2106 | return; |
2107 | |
2108 | gkrellm_record_state(CREATE_CONFIG, mon); |
2109 | (*(mon->create_config))(mon->privat->config_vbox); |
2110 | gkrellm_record_state(INTERNAL, NULL((void*)0)); |
2111 | |
2112 | gtk_widget_show_all(mon->privat->config_vbox); |
2113 | mon->privat->config_created = TRUE(!(0)); |
2114 | } |
2115 | |
2116 | void |
2117 | gkrellm_add_plugin_config_page(GkrellmMonitor *mon) |
2118 | { |
2119 | GtkTreeIter iter, plugin_iter; |
2120 | GtkTreePath *path; |
2121 | |
2122 | if (config_window && mon->create_config) |
2123 | { |
2124 | path = gtk_tree_path_new_from_string("2"); |
2125 | gtk_tree_model_get_iter(GTK_TREE_MODEL(model)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((gtk_tree_model_get_type ())))))), &plugin_iter, path); |
2126 | gtk_tree_path_free(path); |
2127 | |
2128 | gtk_tree_store_append(model, &iter, &plugin_iter); |
2129 | gtk_tree_store_set(model, &iter, NAME_COLUMN, mon->name, -1); |
2130 | mon->privat->config_vbox = |
2131 | create_config_page(mon, model, &iter, config_notebook); |
2132 | mon->privat->config_created = FALSE(0); |
2133 | |
2134 | mon->privat->row_reference = |
2135 | gtk_tree_row_reference_new(GTK_TREE_MODEL(model)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((gtk_tree_model_get_type ())))))), |
2136 | gtk_tree_model_get_path(GTK_TREE_MODEL(model)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((gtk_tree_model_get_type ())))))), &iter)); |
2137 | } |
2138 | else |
2139 | mon->privat->config_page = -1; |
2140 | } |
2141 | |
2142 | void |
2143 | gkrellm_remove_plugin_config_page(GkrellmMonitor *mon) |
2144 | { |
2145 | GtkTreePath *path; |
2146 | GtkTreeIter iter; |
2147 | GList *list; |
2148 | GkrellmMonitor *tmon; |
2149 | |
2150 | if (mon->privat->config_page > 0) |
2151 | { |
2152 | path = gtk_tree_row_reference_get_path(mon->privat->row_reference); |
2153 | gtk_tree_model_get_iter(GTK_TREE_MODEL(model)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((gtk_tree_model_get_type ())))))), &iter, path); |
2154 | gtk_tree_store_remove(model, &iter); |
2155 | |
2156 | gtk_notebook_remove_page(config_notebook, mon->privat->config_page); |
2157 | |
2158 | /* When a config_page is removed, any greater plugin config_page must |
2159 | | be decremented |
2160 | */ |
2161 | for (list = gkrellm_monitor_list; list; list = list->next) |
2162 | { |
2163 | tmon = (GkrellmMonitor *) list->data; |
2164 | if (mon->privat->config_page >= tmon->privat->config_page) |
2165 | continue; |
2166 | tmon->privat->config_page -= 1; |
2167 | gkrellm_debug(DEBUG_GUI0x2000, "config_page %d: %s\n", |
2168 | tmon->privat->config_page, tmon->name); |
2169 | } |
2170 | } |
2171 | mon->privat->config_page = -1; |
2172 | } |
2173 | |
2174 | /* If a config page uses instant apply, hide the APPLY/CLOSE buttons and |
2175 | | assume the config will be modified. |
2176 | */ |
2177 | static void |
2178 | set_apply_mode(gboolean instant) |
2179 | { |
2180 | if (instant) |
2181 | { |
2182 | gtk_widget_hide(apply_button); |
2183 | gtk_widget_hide(close_button); |
2184 | gkrellm_config_modified(); |
2185 | } |
2186 | else |
2187 | { |
2188 | gtk_widget_show(apply_button); |
2189 | gtk_widget_show(close_button); |
2190 | } |
2191 | } |
2192 | |
2193 | static void |
2194 | cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data) |
2195 | { |
2196 | GtkTreeIter iter; |
2197 | GtkTreeModel *model; |
2198 | gint page; |
2199 | gboolean instant; |
2200 | |
2201 | if (!gtk_tree_selection_get_selected(selection, &model, &iter)) |
2202 | return; |
2203 | if (selected_monitor && selected_monitor->apply_config) |
2204 | { |
2205 | gkrellm_record_state(APPLY_CONFIG, selected_monitor); |
2206 | (*(selected_monitor->apply_config))(); |
2207 | gkrellm_record_state(INTERNAL, NULL((void*)0)); |
2208 | } |
2209 | gtk_tree_model_get(model, &iter, |
2210 | MONITOR_COLUMN, &selected_monitor, |
2211 | PAGE_COLUMN, &page, |
2212 | -1); |
2213 | if (selected_monitor && selected_monitor->privat) |
2214 | { |
2215 | page = selected_monitor->privat->config_page; |
2216 | real_create_config(selected_monitor); |
2217 | if (selected_monitor == gkrellm_get_sensors_mon()) |
2218 | { /* Special case dependencies in the configs */ |
2219 | real_create_config(gkrellm_get_cpu_mon()); |
2220 | real_create_config(gkrellm_get_proc_mon()); |
2221 | } |
2222 | instant = ( selected_monitor->apply_config == NULL((void*)0) |
2223 | || selected_monitor->privat->instant_apply); |
2224 | } |
2225 | else |
2226 | instant = TRUE(!(0)); |
2227 | |
2228 | set_apply_mode(instant); |
2229 | |
2230 | gtk_notebook_set_current_page(config_notebook, page); |
2231 | gkrellm_debug(DEBUG_GUI0x2000, "tree_selection_changed %d: %s\n", |
2232 | page, selected_monitor ? selected_monitor->name : "--"); |
2233 | } |
2234 | |
2235 | /* Monitors may want to present as instant apply monitors, but still need |
2236 | | their apply function called when changing notebook pages or on OK button. |
2237 | */ |
2238 | void |
2239 | gkrellm_config_instant_apply(GkrellmMonitor *mon) |
2240 | { |
2241 | mon->privat->instant_apply = TRUE(!(0)); |
2242 | } |
2243 | |
2244 | gboolean |
2245 | gkrellm_config_window_shown(void) |
2246 | { |
2247 | return config_window ? TRUE(!(0)) : FALSE(0); |
2248 | } |
2249 | |
2250 | void |
2251 | create_config_window(void) |
2252 | { |
2253 | GtkWidget *widget, |
2254 | *vbox, |
2255 | *main_vbox, |
2256 | *config_hbox, |
2257 | *hbox; |
2258 | GtkWidget *scrolled; |
2259 | GtkWidget *button; |
2260 | GtkTreeIter iter, citer; |
2261 | GtkTreePath *path; |
2262 | GtkCellRenderer *renderer; |
2263 | GtkTreeViewColumn *column; |
2264 | GtkTreeSelection *select; |
2265 | GList *list; |
2266 | GkrellmMonitor *mon; |
2267 | gchar *config_name, *window_title; |
2268 | |
2269 | if (config_window) |
2270 | { |
2271 | gtk_window_present(GTK_WINDOW(config_window)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (config_window)), ((gtk_window_get_type ()))))))); |
2272 | return; |
2273 | } |
2274 | selected_monitor = NULL((void*)0); |
2275 | |
2276 | config_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2277 | g_signal_connect(G_OBJECT(config_window), "delete_event",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((config_window)), (((GType) ((20) << (2))))))))), ("delete_event"), (((GCallback) (close_config)) ), (((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0) |
2278 | G_CALLBACK(close_config), GINT_TO_POINTER(1))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((config_window)), (((GType) ((20) << (2))))))))), ("delete_event"), (((GCallback) (close_config)) ), (((gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0); |
2279 | |
2280 | config_name = gkrellm_make_config_file_name(NULL((void*)0), "GKrellM"); |
2281 | window_title = g_strdup_printf("%s %s", config_name, _("Configuration")dcgettext ("gkrellm", "Configuration", 5)); |
2282 | gtk_window_set_title(GTK_WINDOW(config_window)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (config_window)), ((gtk_window_get_type ())))))), window_title); |
2283 | g_free(config_name); |
2284 | g_free(window_title); |
2285 | |
2286 | gtk_window_set_wmclass(GTK_WINDOW(config_window)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (config_window)), ((gtk_window_get_type ())))))), |
2287 | "Gkrellm_conf", "Gkrellm"); |
2288 | gtk_container_set_border_width(GTK_CONTAINER(config_window)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((config_window)), ((gtk_container_get_type ())))))), 2); |
2289 | |
2290 | config_hbox = gtk_hbox_new(FALSE(0), 4); |
2291 | gtk_container_add(GTK_CONTAINER(config_window)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((config_window)), ((gtk_container_get_type ())))))), config_hbox); |
2292 | |
2293 | scrolled = gtk_scrolled_window_new(NULL((void*)0), NULL((void*)0)); |
2294 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled)((((GtkScrolledWindow*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_scrolled_window_get_type ())))))), |
2295 | GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
2296 | gtk_box_pack_start(GTK_BOX(config_hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((config_hbox )), ((gtk_box_get_type ())))))), scrolled, FALSE(0), FALSE(0), 0); |
2297 | |
2298 | main_vbox = gtk_vbox_new(FALSE(0), 4); |
2299 | gtk_box_pack_start(GTK_BOX(config_hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((config_hbox )), ((gtk_box_get_type ())))))), main_vbox, TRUE(!(0)), TRUE(!(0)), 0); |
2300 | |
2301 | widget = gtk_notebook_new(); |
2302 | gtk_box_pack_start(GTK_BOX(main_vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((main_vbox )), ((gtk_box_get_type ())))))), widget, TRUE(!(0)), TRUE(!(0)), 0); |
2303 | config_notebook = GTK_NOTEBOOK(widget)((((GtkNotebook*) g_type_check_instance_cast ((GTypeInstance* ) ((widget)), ((gtk_notebook_get_type ())))))); |
2304 | gtk_notebook_set_show_tabs(config_notebook, FALSE(0)); |
2305 | |
2306 | model = gtk_tree_store_new(N_COLUMNS, |
2307 | G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_POINTER((GType) ((17) << (2))), G_TYPE_INT((GType) ((6) << (2)))); |
2308 | gtk_tree_store_append(model, &iter, NULL((void*)0)); |
2309 | gtk_tree_store_set(model, &iter, NAME_COLUMN, _("General")dcgettext ("gkrellm", "General", 5), -1); |
2310 | vbox = create_config_page(NULL((void*)0), model, &iter, config_notebook); |
2311 | create_general_tab(vbox); |
2312 | |
2313 | gtk_tree_store_append(model, &iter, NULL((void*)0)); |
2314 | gtk_tree_store_set(model, &iter, NAME_COLUMN, _("Builtins")dcgettext ("gkrellm", "Builtins", 5), -1); |
2315 | vbox = create_config_page(NULL((void*)0), model, &iter, config_notebook); |
Value stored to 'vbox' is never read | |
2316 | |
2317 | for (list = gkrellm_monitor_list; list; list = list->next) |
2318 | { |
2319 | mon = (GkrellmMonitor *) list->data; |
2320 | if (MONITOR_ID(mon)((mon)->id & 0x1f) == MON_PLUGIN16 || ! mon->create_config) |
2321 | continue; |
2322 | |
2323 | gtk_tree_store_append(model, &citer, &iter); |
2324 | gtk_tree_store_set(model, &citer, NAME_COLUMN, mon->name, -1); |
2325 | mon->privat->config_vbox = |
2326 | create_config_page(mon, model, &citer, config_notebook); |
2327 | mon->privat->config_created = FALSE(0); |
2328 | mon->privat->row_reference = |
2329 | gtk_tree_row_reference_new(GTK_TREE_MODEL(model)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((gtk_tree_model_get_type ())))))), |
2330 | gtk_tree_model_get_path(GTK_TREE_MODEL(model)((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((gtk_tree_model_get_type ())))))), &citer)); |
2331 | } |
2332 | |
2333 | gtk_tree_store_append(model, &iter, NULL((void*)0)); |
2334 | gtk_tree_store_set(model, &iter, NAME_COLUMN, _("Plugins")dcgettext ("gkrellm", "Plugins", 5), -1); |
2335 | vbox = create_config_page(NULL((void*)0), model, &iter, config_notebook); |
2336 | gkrellm_plugins_config_create(vbox); |
2337 | |
2338 | gtk_tree_store_append(model, &iter, NULL((void*)0)); |
2339 | gtk_tree_store_set(model, &iter, NAME_COLUMN, _("Themes")dcgettext ("gkrellm", "Themes", 5), -1); |
2340 | vbox = create_config_page(NULL((void*)0), model, &iter, config_notebook); |
2341 | create_theme_tab(vbox); |
2342 | |
2343 | gtk_tree_store_append(model, &iter, NULL((void*)0)); |
2344 | gtk_tree_store_set(model, &iter, NAME_COLUMN, _("About")dcgettext ("gkrellm", "About", 5), -1); |
2345 | vbox = create_config_page(NULL((void*)0), model, &iter, config_notebook); |
2346 | create_about_tab(vbox); |
2347 | |
2348 | /* Add plugin notebook pages last since they may need special add/remove |
2349 | | actions as plugins are enabled/disabled. |
2350 | */ |
2351 | for (list = gkrellm_monitor_list; list; list = list->next) |
2352 | { |
2353 | mon = (GkrellmMonitor *) list->data; |
2354 | if ( ! mon->create_config |
2355 | || ! mon->privat->enabled |
2356 | || MONITOR_ID(mon)((mon)->id & 0x1f) != MON_PLUGIN16 |
2357 | ) |
2358 | continue; |
2359 | gkrellm_add_plugin_config_page(mon); |
2360 | } |
2361 | |
2362 | /* Create the tree view and don't unref the model because need to modify |
2363 | | it when enabling plugins |
2364 | */ |
2365 | treeview = |
2366 | GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)))((((GtkTreeView*) g_type_check_instance_cast ((GTypeInstance* ) ((gtk_tree_view_new_with_model(((((GtkTreeModel*) g_type_check_instance_cast ((GTypeInstance*) ((model)), ((gtk_tree_model_get_type ()))) )))))), ((gtk_tree_view_get_type ())))))); |
2367 | |
2368 | renderer = gtk_cell_renderer_text_new(); |
2369 | column = gtk_tree_view_column_new_with_attributes(_("Monitors")dcgettext ("gkrellm", "Monitors", 5), renderer, |
2370 | "text", NAME_COLUMN, NULL((void*)0)); |
2371 | gtk_tree_view_append_column(treeview, column); |
2372 | gtk_container_add(GTK_CONTAINER(scrolled)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance *) ((scrolled)), ((gtk_container_get_type ())))))), GTK_WIDGET(treeview)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) ( (treeview)), ((gtk_widget_get_type ()))))))); |
2373 | |
2374 | select = gtk_tree_view_get_selection(treeview); |
2375 | gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); |
2376 | g_signal_connect(G_OBJECT(select), "changed",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((select)), (((GType) ((20) << (2))) )))))), ("changed"), (((GCallback) (cb_tree_selection_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0) |
2377 | G_CALLBACK(cb_tree_selection_changed), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((select)), (((GType) ((20) << (2))) )))))), ("changed"), (((GCallback) (cb_tree_selection_changed ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
2378 | |
2379 | if (expand_builtins) |
2380 | { |
2381 | path = gtk_tree_path_new_from_string("1"); |
2382 | gtk_tree_view_expand_row(treeview, path, TRUE(!(0))); |
2383 | gtk_tree_path_free(path); |
2384 | } |
2385 | if (expand_plugins) |
2386 | { |
2387 | path = gtk_tree_path_new_from_string("2"); |
2388 | gtk_tree_view_expand_row(treeview, path, TRUE(!(0))); |
2389 | gtk_tree_path_free(path); |
2390 | } |
2391 | |
2392 | hbox = gtk_hbutton_box_new(); |
2393 | gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox)((((GtkButtonBox*) g_type_check_instance_cast ((GTypeInstance *) ((hbox)), ((gtk_button_box_get_type ())))))), GTK_BUTTONBOX_END); |
2394 | gtk_box_set_spacing(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), 5); |
2395 | gtk_box_pack_start(GTK_BOX(main_vbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((main_vbox )), ((gtk_box_get_type ())))))), hbox, FALSE(0), FALSE(0), 0); |
2396 | |
2397 | apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY"gtk-apply"); |
2398 | GTK_WIDGET_SET_FLAGS(apply_button, GTK_CAN_DEFAULT)do{ (((((((GtkObject*) g_type_check_instance_cast ((GTypeInstance *) ((apply_button)), ((gtk_object_get_type ()))))))->flags )) |= (GTK_CAN_DEFAULT)); }while (0); |
2399 | g_signal_connect(G_OBJECT(apply_button), "clicked",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((apply_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (apply_config))), (( (void*)0)), ((void*)0), (GConnectFlags) 0) |
2400 | G_CALLBACK(apply_config), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((apply_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (apply_config))), (( (void*)0)), ((void*)0), (GConnectFlags) 0); |
2401 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), apply_button, TRUE(!(0)), TRUE(!(0)), 0); |
2402 | |
2403 | close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE"gtk-close"); |
2404 | GTK_WIDGET_SET_FLAGS(close_button, GTK_CAN_DEFAULT)do{ (((((((GtkObject*) g_type_check_instance_cast ((GTypeInstance *) ((close_button)), ((gtk_object_get_type ()))))))->flags )) |= (GTK_CAN_DEFAULT)); }while (0); |
2405 | g_signal_connect(G_OBJECT(close_button), "clicked",g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((close_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (close_config))), (( (gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0) |
2406 | G_CALLBACK(close_config), GINT_TO_POINTER(1))g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((close_button)), (((GType) ((20) << (2))))))))), ("clicked"), (((GCallback) (close_config))), (( (gpointer) (glong) (1))), ((void*)0), (GConnectFlags) 0); |
2407 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), close_button, TRUE(!(0)), TRUE(!(0)), 0); |
2408 | |
2409 | button = gtk_button_new_from_stock(GTK_STOCK_OK"gtk-ok"); |
2410 | GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT)do{ (((((((GtkObject*) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((gtk_object_get_type ()))))))->flags)) |= ( GTK_CAN_DEFAULT)); }while (0); |
2411 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(OK_config), NULL)g_signal_connect_data ((((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((button)), (((GType) ((20) << (2))) )))))), ("clicked"), (((GCallback) (OK_config))), (((void*)0) ), ((void*)0), (GConnectFlags) 0); |
2412 | gtk_box_pack_start(GTK_BOX(hbox)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((hbox )), ((gtk_box_get_type ())))))), button, TRUE(!(0)), TRUE(!(0)), 0); |
2413 | gtk_widget_grab_default(button); |
2414 | |
2415 | gtk_widget_show_all(config_window); |
2416 | } |
2417 | |
2418 | void |
2419 | gkrellm_open_config_window(GkrellmMonitor *mon) |
2420 | { |
2421 | GtkTreePath *path; |
2422 | |
2423 | if (!mon || !mon->create_config || _GK.no_config) |
2424 | return; |
2425 | create_config_window(); |
2426 | if (MONITOR_ID(mon)((mon)->id & 0x1f) == MON_PLUGIN16) |
2427 | path = gtk_tree_path_new_from_string("2"); |
2428 | else |
2429 | path = gtk_tree_path_new_from_string("1"); |
2430 | |
2431 | gtk_tree_view_expand_row(treeview, path, TRUE(!(0))); |
2432 | gtk_tree_path_free(path); |
2433 | |
2434 | path = gtk_tree_row_reference_get_path(mon->privat->row_reference); |
2435 | gtk_tree_view_set_cursor(treeview, path, NULL((void*)0), FALSE(0)); |
2436 | } |
2437 | |
2438 | static const char *ui_items_no_config = "\ |
2439 | <ui>\ |
2440 | <popup>\ |
2441 | <separator/>\ |
2442 | <menuitem name=\"Quit\" action=\"QuitAction\"/>\ |
2443 | <separator/>\ |
2444 | </popup>\ |
2445 | </ui>\ |
2446 | "; |
2447 | |
2448 | static const char *ui_items = "\ |
2449 | <ui>\ |
2450 | <popup accelerators=\"true\">\ |
2451 | <menuitem name=\"Configuration\" action=\"ConfigurationAction\"/>\ |
2452 | <menu name=\"ThemeMenu\" action=\"ThemeMenuAction\">\ |
2453 | <menuitem name=\"ThemeAltNext\" action=\"ThemeAltNextAction\"/>\ |
2454 | <menuitem name=\"ThemeAltPrev\" action=\"ThemeAltPrevAction\"/>\ |
2455 | </menu>\ |
2456 | <separator/>\ |
2457 | <menuitem name=\"Quit\" action=\"QuitAction\"/>\ |
2458 | </popup>\ |
2459 | </ui>\ |
2460 | "; |
2461 | |
2462 | /* |
2463 | static const char *ui_items_debug = "\ |
2464 | <popup>\ |
2465 | <menuitem name=\"ThemeNext\" action=\"ThemeNextAction\"/>\ |
2466 | <menuitem name=\"ThemePrev\" action=\"ThemePrevAction\"/>\ |
2467 | <menuitem name=\"MenuPopup\" action=\"MenuPopupAction\"/>\ |
2468 | <menuitem name=\"ReloadTheme\" action=\"ReloadThemeAction\"/>\ |
2469 | <menuitem name=\"ScaleThemeUp\" action=\"ScaleThemeUpAction\"/>\ |
2470 | <menuitem name=\"ScaleThemeDn\" action=\"ScaleThemeDnAction\"/>\ |
2471 | </popup>\ |
2472 | "; |
2473 | */ |
2474 | |
2475 | static GtkActionEntry ui_entries[] = |
2476 | { |
2477 | { "QuitAction", NULL((void*)0), N_("Quit")("Quit"), |
2478 | NULL((void*)0), NULL((void*)0), G_CALLBACK(gtk_main_quit)((GCallback) (gtk_main_quit)) }, |
2479 | { "ConfigurationAction", NULL((void*)0), N_("Configuration")("Configuration"), |
2480 | "F1", NULL((void*)0), G_CALLBACK(create_config_window)((GCallback) (create_config_window)) }, |
2481 | { "ThemeMenuAction", NULL((void*)0), N_("Theme")("Theme"), |
2482 | NULL((void*)0), NULL((void*)0), NULL((void*)0) }, |
2483 | { "ThemeAltNextAction", NULL((void*)0), N_("Next")("Next"), |
2484 | "Page_Up", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2485 | { "ThemeAltPrevAction", NULL((void*)0), N_("Prev")("Prev"), |
2486 | "Page_Down", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2487 | { "ThemeNextAction", NULL((void*)0), N_("Theme next")("Theme next"), |
2488 | "<control>Page_Up", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2489 | { "ThemePrevAction", NULL((void*)0), N_("Theme prev")("Theme prev"), |
2490 | "<control>Page_Down", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2491 | { "MenuPopupAction", NULL((void*)0), N_("Menu Popup")("Menu Popup"), |
2492 | "F2", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2493 | { "ReloadThemeAction", NULL((void*)0), N_("Reload Theme")("Reload Theme"), |
2494 | "F5", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2495 | { "ScaleThemeUpAction", NULL((void*)0), N_("Scale Theme Up")("Scale Theme Up"), |
2496 | "F6", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2497 | { "ScaleThemeDnAction", NULL((void*)0), N_("Scale Theme Dn")("Scale Theme Dn"), |
2498 | "F7", NULL((void*)0), G_CALLBACK(cb_load_theme)((GCallback) (cb_load_theme)) }, |
2499 | }; |
2500 | static guint n_ui_entries = G_N_ELEMENTS (ui_entries)(sizeof (ui_entries) / sizeof ((ui_entries)[0])); |
2501 | |
2502 | GtkUIManager * |
2503 | gkrellm_create_ui_manager_popup(void) |
2504 | { |
2505 | GtkWidget *top_win; |
2506 | GtkUIManager *ui_manager; |
2507 | GtkActionGroup *action_group; |
2508 | GError *error; |
2509 | |
2510 | top_win = gkrellm_get_top_window(); |
2511 | action_group = gtk_action_group_new ("UiActions"); |
2512 | gtk_action_group_add_actions (action_group, ui_entries, n_ui_entries, NULL((void*)0)); |
2513 | ui_manager = gtk_ui_manager_new (); |
2514 | gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); |
2515 | error = NULL((void*)0); |
2516 | if (_GK.no_config) |
2517 | gtk_ui_manager_add_ui_from_string (ui_manager, ui_items_no_config, |
2518 | strlen(ui_items_no_config), &error); |
2519 | else |
2520 | gtk_ui_manager_add_ui_from_string (ui_manager, ui_items, |
2521 | strlen(ui_items), &error); |
2522 | if (error) |
2523 | { |
2524 | g_message ("building menus failed: %s", error->message); |
2525 | g_error_free (error); |
2526 | return NULL((void*)0); |
2527 | } |
2528 | gtk_window_add_accel_group(GTK_WINDOW(top_win)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) ( (top_win)), ((gtk_window_get_type ())))))), |
2529 | gtk_ui_manager_get_accel_group (ui_manager)); |
2530 | |
2531 | return ui_manager; |
2532 | } |
2533 |