static void on_button_layout_changed (GtkEditable *entry, WBPlugin *wb) { if (gtk_widget_get_sensitive (GTK_WIDGET(entry))) { const gchar *button_layout = gtk_entry_get_text (GTK_ENTRY(entry)); wb->prefs->button_layout = button_layout_filter (button_layout, wb->prefs->button_layout); if (wb->prefs->sync_wm_theme) { gchar *part; const gchar *layout; const gchar *wm_button_layout = xfconf_channel_get_string(wb->wm_channel, "/general/button_layout", "O|HMC"); /* get opposite part of the layout and concatenate it */ part = opposite_layout_filter (wm_button_layout); if (wm_button_layout[0] == part[0]) layout = g_strconcat (part, wb->prefs->button_layout, NULL); else layout = g_strconcat (wb->prefs->button_layout, part, NULL); xfconf_channel_set_string (wb->wm_channel, "/general/button_layout", layout); g_free (part); } else { replace_buttons (wb->prefs->button_layout, wb); on_wck_state_changed (wb->win->controlwindow, wb); } } }
static void wckbuttons_read (WBPlugin *wb) { XfceRc *rc; gchar *file; const gchar *button_layout, *theme; /* allocate memory for the preferences structure */ wb->prefs = g_slice_new0(WBPreferences); /* get the plugin config file location */ file = xfce_panel_plugin_save_location (wb->plugin, TRUE); if (G_LIKELY (file != NULL)) { /* open the config file, readonly */ rc = xfce_rc_simple_open (file, TRUE); /* cleanup */ g_free (file); if (G_LIKELY (rc != NULL)) { /* read the settings */ wb->prefs->only_maximized = xfce_rc_read_bool_entry(rc, "only_maximized", DEFAULT_ONLY_MAXIMIZED); wb->prefs->show_on_desktop = xfce_rc_read_bool_entry(rc, "show_on_desktop", DEFAULT_SHOW_ON_DESKTOP); wb->prefs->sync_wm_theme = xfce_rc_read_bool_entry(rc, "sync_wm_theme", DEFAULT_SYNC_WM_THEME); button_layout = xfce_rc_read_entry (rc, "button_layout", DEFAULT_BUTTON_LAYOUT); wb->prefs->button_layout = button_layout_filter (button_layout, DEFAULT_BUTTON_LAYOUT); theme = xfce_rc_read_entry (rc, "theme", DEFAULT_THEME); wb->prefs->theme = g_strdup (theme); wb->prefs->inactive_text_alpha = xfce_rc_read_int_entry (rc, "inactive_text_alpha", DEFAULT_INACTIVE_TEXT_ALPHA); wb->prefs->inactive_text_shade = xfce_rc_read_int_entry (rc, "inactive_text_shade", DEFAULT_INACTIVE_TEXT_SHADE); /* cleanup */ xfce_rc_close (rc); /* leave the function, everything went well */ return; } } /* something went wrong, apply default values */ DBG ("Applying default settings"); wb->prefs->only_maximized = DEFAULT_ONLY_MAXIMIZED; wb->prefs->show_on_desktop = DEFAULT_SHOW_ON_DESKTOP; wb->prefs->sync_wm_theme = DEFAULT_SYNC_WM_THEME; wb->prefs->button_layout = DEFAULT_BUTTON_LAYOUT; wb->prefs->theme = DEFAULT_THEME; wb->prefs->inactive_text_alpha = DEFAULT_INACTIVE_TEXT_ALPHA; wb->prefs->inactive_text_shade = DEFAULT_INACTIVE_TEXT_SHADE; }