Lines 22-27
Link Here
|
22 |
#endif |
22 |
#endif |
23 |
|
23 |
|
24 |
#include <libxfcegui4/libxfcegui4.h> |
24 |
#include <libxfcegui4/libxfcegui4.h> |
|
|
25 |
#include <libxfce4util/libxfce4util.h> |
25 |
|
26 |
|
26 |
#include "xfce-desktop.h" |
27 |
#include "xfce-desktop.h" |
27 |
#include "xfdesktop-common.h" |
28 |
#include "xfdesktop-common.h" |
Lines 40-45
enum {
Link Here
|
40 |
#endif |
41 |
#endif |
41 |
}; |
42 |
}; |
42 |
|
43 |
|
|
|
44 |
#ifdef ENABLE_DESKTOP_ICONS |
45 |
enum { |
46 |
SHOW_HOME = 1, |
47 |
SHOW_FS, |
48 |
SHOW_TRASH, |
49 |
SHOW_REMOVABLE, |
50 |
SHOW_MAX |
51 |
}; |
52 |
#endif |
53 |
|
43 |
/* globals */ |
54 |
/* globals */ |
44 |
static gboolean show_windowlist = TRUE; |
55 |
static gboolean show_windowlist = TRUE; |
45 |
#ifdef USE_DESKTOP_MENU |
56 |
#ifdef USE_DESKTOP_MENU |
Lines 56-61
static guint desktop_icons_font_size = 12; /* default, i guess */
Link Here
|
56 |
static guint desktop_icons_icon_size = 32; /* default */ |
67 |
static guint desktop_icons_icon_size = 32; /* default */ |
57 |
#endif |
68 |
#endif |
58 |
|
69 |
|
|
|
70 |
void |
71 |
apply_show_config(BackdropDialog *bd) |
72 |
{ |
73 |
gchar *rcfile; |
74 |
XfceRc *conf; |
75 |
gboolean flags[SHOW_MAX]; |
76 |
|
77 |
rcfile = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "xfce4/desktop/xfdesktoprc", TRUE); |
78 |
conf = xfce_rc_simple_open (rcfile, TRUE); |
79 |
g_free(rcfile); |
80 |
|
81 |
if(conf) { |
82 |
xfce_rc_set_group (conf, "file-icons"); |
83 |
|
84 |
#define get_bool(flag, setting) \ |
85 |
flags[flag] = xfce_rc_read_bool_entry(conf, setting, TRUE) |
86 |
get_bool(SHOW_HOME, "show-home"); |
87 |
get_bool(SHOW_FS, "show-filesystem"); |
88 |
get_bool(SHOW_TRASH, "show-trash"); |
89 |
get_bool(SHOW_REMOVABLE, "show-removable"); |
90 |
#undef get_bool |
91 |
|
92 |
xfce_rc_close(conf); |
93 |
} else { |
94 |
gint flag; |
95 |
/* By default, all icons are shown */ |
96 |
for(flag = 0; flag < SHOW_MAX; ++flag) { |
97 |
flags[flag] = TRUE; |
98 |
} |
99 |
} |
100 |
|
101 |
#define set_active(button, flag) \ |
102 |
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), flags[flag]) |
103 |
set_active(bd->chk_show_home, SHOW_HOME); |
104 |
set_active(bd->chk_show_fs, SHOW_FS); |
105 |
set_active(bd->chk_show_trash, SHOW_TRASH); |
106 |
set_active(bd->chk_show_removable, SHOW_REMOVABLE); |
107 |
#undef set_active |
108 |
} |
109 |
|
110 |
static void |
111 |
set_show_option(GtkWidget *w, gpointer user_data) |
112 |
{ |
113 |
BackdropDialog *bd = (BackdropDialog *)user_data; |
114 |
guint opt; |
115 |
gchar *rcfile; |
116 |
XfceRc *conf; |
117 |
gboolean gb; |
118 |
|
119 |
opt = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(w), "xfce-shownum")); |
120 |
rcfile = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "xfce4/desktop/xfdesktoprc", TRUE); |
121 |
conf = xfce_rc_simple_open (rcfile, FALSE); |
122 |
xfce_rc_set_group (conf, "file-icons"); |
123 |
|
124 |
gb = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
125 |
|
126 |
switch(opt) { |
127 |
case SHOW_HOME: |
128 |
xfce_rc_write_bool_entry (conf, "show-home", gb); |
129 |
break; |
130 |
|
131 |
case SHOW_FS: |
132 |
xfce_rc_write_bool_entry (conf, "show-filesystem", gb); |
133 |
break; |
134 |
|
135 |
case SHOW_TRASH: |
136 |
xfce_rc_write_bool_entry (conf, "show-trash", gb); |
137 |
break; |
138 |
|
139 |
case SHOW_REMOVABLE: |
140 |
xfce_rc_write_bool_entry (conf, "show-removable", gb); |
141 |
break; |
142 |
|
143 |
default: |
144 |
g_warning("xfdesktop menu: got invalid checkbox ID"); |
145 |
return; |
146 |
} |
147 |
|
148 |
xfce_rc_close(conf); |
149 |
g_free(rcfile); |
150 |
} |
151 |
|
59 |
static void |
152 |
static void |
60 |
set_chk_option(GtkWidget *w, gpointer user_data) |
153 |
set_chk_option(GtkWidget *w, gpointer user_data) |
61 |
{ |
154 |
{ |
Lines 138-143
set_di_option(GtkComboBox *combo,
Link Here
|
138 |
} else |
231 |
} else |
139 |
gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); |
232 |
gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); |
140 |
|
233 |
|
|
|
234 |
if(desktop_icon_style == XFCE_DESKTOP_ICON_STYLE_FILES) |
235 |
gtk_widget_set_sensitive(bd->hbox_show_icons, TRUE); |
236 |
else |
237 |
gtk_widget_set_sensitive(bd->hbox_show_icons, FALSE); |
141 |
|
238 |
|
142 |
mcs_manager_set_int(bd->plugin->manager, "desktopiconstyle", |
239 |
mcs_manager_set_int(bd->plugin->manager, "desktopiconstyle", |
143 |
BACKDROP_CHANNEL, desktop_icon_style); |
240 |
BACKDROP_CHANNEL, desktop_icon_style); |
Lines 229-235
behavior_page_create(BackdropDialog *bd)
Link Here
|
229 |
GtkWidget *btn; |
326 |
GtkWidget *btn; |
230 |
#endif |
327 |
#endif |
231 |
#ifdef ENABLE_DESKTOP_ICONS |
328 |
#ifdef ENABLE_DESKTOP_ICONS |
232 |
GtkWidget *combo, *sbtn, *lbl, *hbox; |
329 |
GtkWidget *combo, *sbtn, *lbl, *hbox, *table; |
233 |
#endif |
330 |
#endif |
234 |
|
331 |
|
235 |
kiosk = xfce_kiosk_new("xfdesktop"); |
332 |
kiosk = xfce_kiosk_new("xfdesktop"); |
Lines 349-360
behavior_page_create(BackdropDialog *bd)
Link Here
|
349 |
G_CALLBACK(set_sbtn_option), bd); |
446 |
G_CALLBACK(set_sbtn_option), bd); |
350 |
|
447 |
|
351 |
gtk_widget_set_sensitive(bd->frame_sysfont, !desktop_icons_use_system_font); |
448 |
gtk_widget_set_sensitive(bd->frame_sysfont, !desktop_icons_use_system_font); |
|
|
449 |
|
450 |
if (desktop_icon_style != XFCE_DESKTOP_ICON_STYLE_FILES) |
451 |
gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); |
352 |
|
452 |
|
353 |
if(desktop_icon_style == XFCE_DESKTOP_ICON_STYLE_NONE) |
453 |
if(desktop_icon_style == XFCE_DESKTOP_ICON_STYLE_NONE) |
354 |
gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); |
454 |
gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); |
355 |
|
455 |
|
356 |
if(!xfce_kiosk_query(kiosk, "CustomizeDesktopIcons")) |
456 |
if(!xfce_kiosk_query(kiosk, "CustomizeDesktopIcons")) |
357 |
gtk_widget_set_sensitive(frame_bin, FALSE); |
457 |
gtk_widget_set_sensitive(frame_bin, FALSE); |
|
|
458 |
|
459 |
bd->hbox_show_icons = gtk_hbox_new (FALSE, FALSE); |
460 |
gtk_widget_show(bd->hbox_show_icons); |
461 |
gtk_box_pack_start(GTK_BOX(bd->vbox_icon_settings),bd->hbox_show_icons, FALSE, FALSE, 0); |
462 |
|
463 |
table = gtk_table_new (3, 3, TRUE); |
464 |
gtk_widget_show (table); |
465 |
gtk_box_pack_start(GTK_BOX(bd->hbox_show_icons), table, FALSE, FALSE, 0); |
466 |
|
467 |
lbl = gtk_label_new_with_mnemonic(_("Show ic_ons for: ")); |
468 |
gtk_widget_show(lbl); |
469 |
gtk_table_attach(GTK_TABLE (table), lbl, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); |
470 |
|
471 |
bd->chk_show_home = gtk_check_button_new_with_mnemonic(_("_home")); |
472 |
gtk_widget_show (bd->chk_show_home); |
473 |
g_object_set_data(G_OBJECT(bd->chk_show_home), "xfce-shownum", GUINT_TO_POINTER(SHOW_HOME)); |
474 |
gtk_table_attach(GTK_TABLE (table), bd->chk_show_home, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); |
475 |
|
476 |
bd->chk_show_fs = gtk_check_button_new_with_mnemonic(_("_file system")); |
477 |
gtk_widget_show (bd->chk_show_fs); |
478 |
g_object_set_data(G_OBJECT(bd->chk_show_fs), "xfce-shownum", GUINT_TO_POINTER(SHOW_FS)); |
479 |
gtk_table_attach(GTK_TABLE (table), bd->chk_show_fs, 1, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0); |
480 |
|
481 |
bd->chk_show_trash = gtk_check_button_new_with_mnemonic(_("_trash")); |
482 |
gtk_widget_show (bd->chk_show_trash); |
483 |
g_object_set_data(G_OBJECT(bd->chk_show_trash), "xfce-shownum", GUINT_TO_POINTER(SHOW_TRASH)); |
484 |
gtk_table_attach(GTK_TABLE (table), bd->chk_show_trash, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0); |
485 |
|
486 |
bd->chk_show_removable = gtk_check_button_new_with_mnemonic(_("_removable devices")); |
487 |
gtk_widget_show (bd->chk_show_removable); |
488 |
g_object_set_data(G_OBJECT(bd->chk_show_removable), "xfce-shownum", GUINT_TO_POINTER(SHOW_REMOVABLE)); |
489 |
gtk_table_attach(GTK_TABLE (table), bd->chk_show_removable, 1, 3, 2, 3, GTK_FILL, GTK_FILL, 0, 0); |
490 |
|
491 |
g_signal_connect(G_OBJECT(bd->chk_show_home), "toggled", G_CALLBACK(set_show_option), bd); |
492 |
g_signal_connect(G_OBJECT(bd->chk_show_fs), "toggled", G_CALLBACK(set_show_option), bd); |
493 |
g_signal_connect(G_OBJECT(bd->chk_show_trash), "toggled", G_CALLBACK(set_show_option), bd); |
494 |
g_signal_connect(G_OBJECT(bd->chk_show_removable), "toggled", G_CALLBACK(set_show_option), bd); |
495 |
|
496 |
apply_show_config(bd); |
497 |
|
358 |
#endif |
498 |
#endif |
359 |
|
499 |
|
360 |
xfce_kiosk_free(kiosk); |
500 |
xfce_kiosk_free(kiosk); |