ALT Linux Bugzilla
– Attachment 2182 Details for
Bug 12681
Падает при отсутствии файла .config/xfce4/desktop/xfdesktoprc
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Более правильная версия special_icons_config.patch
03_special_icons_config.patch (text/plain), 7.25 KB, created by
avm
on 2007-09-04 14:43:27 MSD
(
hide
)
Description:
Более правильная версия special_icons_config.patch
Filename:
MIME Type:
Creator:
avm
Created:
2007-09-04 14:43:27 MSD
Size:
7.25 KB
patch
obsolete
>diff --git a/xfdesktop/settings/behavior-settings.c b/xfdesktop/settings/behavior-settings.c >index 829f076..fc257be 100644 >--- a/xfdesktop/settings/behavior-settings.c >+++ b/xfdesktop/settings/behavior-settings.c >@@ -22,6 +22,7 @@ > #endif > > #include <libxfcegui4/libxfcegui4.h> >+#include <libxfce4util/libxfce4util.h> > > #include "xfce-desktop.h" > #include "xfdesktop-common.h" >@@ -40,6 +41,16 @@ enum { > #endif > }; > >+#ifdef ENABLE_DESKTOP_ICONS >+enum { >+ SHOW_HOME = 1, >+ SHOW_FS, >+ SHOW_TRASH, >+ SHOW_REMOVABLE, >+ SHOW_MAX >+}; >+#endif >+ > /* globals */ > static gboolean show_windowlist = TRUE; > #ifdef USE_DESKTOP_MENU >@@ -56,6 +67,88 @@ static guint desktop_icons_font_size = 12; /* default, i guess */ > static guint desktop_icons_icon_size = 32; /* default */ > #endif > >+void >+apply_show_config(BackdropDialog *bd) >+{ >+ gchar *rcfile; >+ XfceRc *conf; >+ gboolean flags[SHOW_MAX]; >+ >+ rcfile = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "xfce4/desktop/xfdesktoprc", TRUE); >+ conf = xfce_rc_simple_open (rcfile, TRUE); >+ g_free(rcfile); >+ >+ if(conf) { >+ xfce_rc_set_group (conf, "file-icons"); >+ >+#define get_bool(flag, setting) \ >+ flags[flag] = xfce_rc_read_bool_entry(conf, setting, TRUE) >+ get_bool(SHOW_HOME, "show-home"); >+ get_bool(SHOW_FS, "show-filesystem"); >+ get_bool(SHOW_TRASH, "show-trash"); >+ get_bool(SHOW_REMOVABLE, "show-removable"); >+#undef get_bool >+ >+ xfce_rc_close(conf); >+ } else { >+ gint flag; >+ /* By default, all icons are shown */ >+ for(flag = 0; flag < SHOW_MAX; ++flag) { >+ flags[flag] = TRUE; >+ } >+ } >+ >+#define set_active(button, flag) \ >+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), flags[flag]) >+ set_active(bd->chk_show_home, SHOW_HOME); >+ set_active(bd->chk_show_fs, SHOW_FS); >+ set_active(bd->chk_show_trash, SHOW_TRASH); >+ set_active(bd->chk_show_removable, SHOW_REMOVABLE); >+#undef set_active >+} >+ >+static void >+set_show_option(GtkWidget *w, gpointer user_data) >+{ >+ BackdropDialog *bd = (BackdropDialog *)user_data; >+ guint opt; >+ gchar *rcfile; >+ XfceRc *conf; >+ gboolean gb; >+ >+ opt = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(w), "xfce-shownum")); >+ rcfile = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "xfce4/desktop/xfdesktoprc", TRUE); >+ conf = xfce_rc_simple_open (rcfile, FALSE); >+ xfce_rc_set_group (conf, "file-icons"); >+ >+ gb = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); >+ >+ switch(opt) { >+ case SHOW_HOME: >+ xfce_rc_write_bool_entry (conf, "show-home", gb); >+ break; >+ >+ case SHOW_FS: >+ xfce_rc_write_bool_entry (conf, "show-filesystem", gb); >+ break; >+ >+ case SHOW_TRASH: >+ xfce_rc_write_bool_entry (conf, "show-trash", gb); >+ break; >+ >+ case SHOW_REMOVABLE: >+ xfce_rc_write_bool_entry (conf, "show-removable", gb); >+ break; >+ >+ default: >+ g_warning("xfdesktop menu: got invalid checkbox ID"); >+ return; >+ } >+ >+ xfce_rc_close(conf); >+ g_free(rcfile); >+} >+ > static void > set_chk_option(GtkWidget *w, gpointer user_data) > { >@@ -138,6 +231,10 @@ set_di_option(GtkComboBox *combo, > } else > gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); > >+ if(desktop_icon_style == XFCE_DESKTOP_ICON_STYLE_FILES) >+ gtk_widget_set_sensitive(bd->hbox_show_icons, TRUE); >+ else >+ gtk_widget_set_sensitive(bd->hbox_show_icons, FALSE); > > mcs_manager_set_int(bd->plugin->manager, "desktopiconstyle", > BACKDROP_CHANNEL, desktop_icon_style); >@@ -229,7 +326,7 @@ behavior_page_create(BackdropDialog *bd) > GtkWidget *btn; > #endif > #ifdef ENABLE_DESKTOP_ICONS >- GtkWidget *combo, *sbtn, *lbl, *hbox; >+ GtkWidget *combo, *sbtn, *lbl, *hbox, *table; > #endif > > kiosk = xfce_kiosk_new("xfdesktop"); >@@ -349,12 +446,55 @@ behavior_page_create(BackdropDialog *bd) > G_CALLBACK(set_sbtn_option), bd); > > gtk_widget_set_sensitive(bd->frame_sysfont, !desktop_icons_use_system_font); >+ >+ if (desktop_icon_style != XFCE_DESKTOP_ICON_STYLE_FILES) >+ gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); > > if(desktop_icon_style == XFCE_DESKTOP_ICON_STYLE_NONE) > gtk_widget_set_sensitive(bd->vbox_icon_settings, FALSE); > > if(!xfce_kiosk_query(kiosk, "CustomizeDesktopIcons")) > gtk_widget_set_sensitive(frame_bin, FALSE); >+ >+ bd->hbox_show_icons = gtk_hbox_new (FALSE, FALSE); >+ gtk_widget_show(bd->hbox_show_icons); >+ gtk_box_pack_start(GTK_BOX(bd->vbox_icon_settings),bd->hbox_show_icons, FALSE, FALSE, 0); >+ >+ table = gtk_table_new (3, 3, TRUE); >+ gtk_widget_show (table); >+ gtk_box_pack_start(GTK_BOX(bd->hbox_show_icons), table, FALSE, FALSE, 0); >+ >+ lbl = gtk_label_new_with_mnemonic(_("Show ic_ons for: ")); >+ gtk_widget_show(lbl); >+ gtk_table_attach(GTK_TABLE (table), lbl, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); >+ >+ bd->chk_show_home = gtk_check_button_new_with_mnemonic(_("_home")); >+ gtk_widget_show (bd->chk_show_home); >+ g_object_set_data(G_OBJECT(bd->chk_show_home), "xfce-shownum", GUINT_TO_POINTER(SHOW_HOME)); >+ gtk_table_attach(GTK_TABLE (table), bd->chk_show_home, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); >+ >+ bd->chk_show_fs = gtk_check_button_new_with_mnemonic(_("_file system")); >+ gtk_widget_show (bd->chk_show_fs); >+ g_object_set_data(G_OBJECT(bd->chk_show_fs), "xfce-shownum", GUINT_TO_POINTER(SHOW_FS)); >+ gtk_table_attach(GTK_TABLE (table), bd->chk_show_fs, 1, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0); >+ >+ bd->chk_show_trash = gtk_check_button_new_with_mnemonic(_("_trash")); >+ gtk_widget_show (bd->chk_show_trash); >+ g_object_set_data(G_OBJECT(bd->chk_show_trash), "xfce-shownum", GUINT_TO_POINTER(SHOW_TRASH)); >+ gtk_table_attach(GTK_TABLE (table), bd->chk_show_trash, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0); >+ >+ bd->chk_show_removable = gtk_check_button_new_with_mnemonic(_("_removable devices")); >+ gtk_widget_show (bd->chk_show_removable); >+ g_object_set_data(G_OBJECT(bd->chk_show_removable), "xfce-shownum", GUINT_TO_POINTER(SHOW_REMOVABLE)); >+ gtk_table_attach(GTK_TABLE (table), bd->chk_show_removable, 1, 3, 2, 3, GTK_FILL, GTK_FILL, 0, 0); >+ >+ g_signal_connect(G_OBJECT(bd->chk_show_home), "toggled", G_CALLBACK(set_show_option), bd); >+ g_signal_connect(G_OBJECT(bd->chk_show_fs), "toggled", G_CALLBACK(set_show_option), bd); >+ g_signal_connect(G_OBJECT(bd->chk_show_trash), "toggled", G_CALLBACK(set_show_option), bd); >+ g_signal_connect(G_OBJECT(bd->chk_show_removable), "toggled", G_CALLBACK(set_show_option), bd); >+ >+ apply_show_config(bd); >+ > #endif > > xfce_kiosk_free(kiosk); >diff --git a/xfdesktop/settings/settings-common.h b/xfdesktop/settings/settings-common.h >index 23ee513..00f0113 100644 >--- a/xfdesktop/settings/settings-common.h >+++ b/xfdesktop/settings/settings-common.h >@@ -45,6 +45,11 @@ typedef struct { > #ifdef ENABLE_DESKTOP_ICONS > GtkWidget *vbox_icon_settings; > GtkWidget *frame_sysfont; >+ GtkWidget *chk_show_home; >+ GtkWidget *chk_show_fs; >+ GtkWidget *chk_show_trash; >+ GtkWidget *chk_show_removable; >+ GtkWidget *hbox_show_icons; > #endif > } BackdropDialog; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 12681
: 2182