static void lightdash_read (LightdashPlugin *lightdash)
{
    XfceRc *rc;
    gchar *file;
    const gchar *value;

    file = xfce_panel_plugin_save_location (lightdash->plugin, TRUE);

    if (G_LIKELY (file != NULL))
    {
        rc = xfce_rc_simple_open (file, TRUE);

        g_free (file);

        if (G_LIKELY (rc != NULL))
        {
            value = xfce_rc_read_entry (rc, "button-title", g_strdup (BUTTON_TITLE_DEFAULT));
            lightdash->button_title = g_strdup (value);
            lightdash->opacity = xfce_rc_read_int_entry (rc, "opacity", DEFAULT_OPACITY);
            lightdash->show_desktop = xfce_rc_read_int_entry (rc, "show-desktop", DEFAULT_SHOW_DESKTOP);

            xfce_rc_close (rc);

            return;
        }

    }

    lightdash->button_title = g_strdup (BUTTON_TITLE_DEFAULT);
    lightdash->opacity = DEFAULT_OPACITY;
}
static void
screenshot_read_rc_file (XfcePanelPlugin *plugin, ScreenshotData *screenshot)
{
    char *file;
    XfceRc *rc;
    gint screenshot_delay = 2;
    gint window_delay = 2;
    gint whole_screen = 1;
    gint ask_for_file = 1;
    
    if ((file = xfce_panel_plugin_lookup_rc_file (plugin)) != NULL)
    {
        rc = xfce_rc_simple_open (file, TRUE);
        g_free (file);

        if (rc != NULL)
        {
            screenshot_delay = xfce_rc_read_int_entry (rc, "screenshot_delay", 2);
            window_delay = xfce_rc_read_int_entry (rc, "window_delay", 2);
            whole_screen = xfce_rc_read_int_entry (rc, "whole_screen", 1);
            ask_for_file = xfce_rc_read_int_entry (rc, "ask_for_file", 1);
            
            xfce_rc_close (rc);
        }
    }

    screenshot->screenshot_delay = screenshot_delay;
    screenshot->window_delay = window_delay;
    screenshot->whole_screen = whole_screen;
    screenshot->ask_for_file = ask_for_file;
}
Esempio n. 3
0
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;
}
Esempio n. 4
0
static void
migrate_46_plugin_actions (XfconfChannel *channel,
                           XfceRc        *rc)
{
  gint  type;
  guint first_action = 0;
  guint second_action = 0;

  if (!xfce_rc_has_entry (rc, "type"))
    return;

  type = xfce_rc_read_int_entry (rc, "types", 0);
  switch (type)
    {
    case 0: /* ACTION_QUIT */
      first_action = 1;
      break;

    case 1: /* ACTION_LOCK */
      first_action = 2;
      break;

    default: /* ACTION_QUIT_LOCK */
      first_action = 1;
      second_action = 3;
      break;
    }

    xfconf_channel_set_uint (channel, "/first-action", first_action);
    xfconf_channel_set_uint (channel, "/second-action", second_action);
}
static gboolean
xkb_load_config (t_xkb *xkb, const gchar *filename)
{
    XfceRc* rcfile;
    gint text_scale;

    if ((rcfile = xfce_rc_simple_open (filename, TRUE)))
    {
        xfce_rc_set_group (rcfile, NULL);

        xkb->display_type = xfce_rc_read_int_entry (rcfile, "display_type", DISPLAY_TYPE_IMAGE);
        text_scale = xfce_rc_read_int_entry (rcfile, "display_textscale", -1);
        if (text_scale < 0)
        {
            /* Check if the old textsize value is there */
            text_scale = xfce_rc_read_int_entry (rcfile, "display_textsize", -1);
            switch (text_scale)
            {
            case DISPLAY_TEXTSIZE_SMALL:
                text_scale = 47;
                break;
            case DISPLAY_TEXTSIZE_MEDIUM:
                text_scale = 70;
                break;
            case DISPLAY_TEXTSIZE_LARGE:
            default:
                text_scale = DISPLAY_TEXTSCALE_LARGE;
                break;
            }
        }
        xkb->display_text_scale = text_scale;
        xkb->display_img_scale = xfce_rc_read_int_entry (rcfile, "display_imgscale", DISPLAY_IMGSCALE_LARGE);
        xkb->group_policy = xfce_rc_read_int_entry (rcfile, "group_policy", GROUP_POLICY_PER_APPLICATION);

        xfce_rc_close (rcfile);

        return TRUE;
    }

    return FALSE;
}
Esempio n. 6
0
gboolean quicklauncher_load_config(t_quicklauncher *quicklauncher, const gchar* filename)
{

	XfceRc* rcfile;
	gint i;
	
	if( (rcfile = xfce_rc_simple_open(filename, TRUE) ))
	{
		xfce_rc_set_group(rcfile, NULL);
		quicklauncher->nb_lines = xfce_rc_read_int_entry(rcfile, "nb_lines", 1);
		i = xfce_rc_read_int_entry(rcfile, "nb_launcher", 0);
		g_assert(i >= 0);
		while(i)
		{
			t_launcher *launcher = launcher_load_config(rcfile, i, quicklauncher);
			quicklauncher_add_element(quicklauncher, launcher);
			i--;
			if(!i)
				return TRUE;
		}
	}
	return FALSE;
}
Esempio n. 7
0
static void
migrate_46_plugin_windowlist (XfconfChannel *channel,
                              XfceRc        *rc)
{
  if (xfce_rc_has_entry (rc, "urgency_notify"))
    xfconf_channel_set_bool (channel, "/urgentcy-notification",
      xfce_rc_read_int_entry (rc, "button_layout", 0) > 0);

  migrate_46_plugin_uint ("button_layout", "style", 0);
  migrate_46_plugin_bool ("show_all_workspaces", "all-workspaces", TRUE);
  migrate_46_plugin_bool ("show_workspace_actions", "workspace-actions", FALSE);

  /* TODO
   * xfce_rc_read_bool_entry (rc, "show_window_icons", TRUE); */
}
Esempio n. 8
0
t_launcher*
launcher_load_config(XfceRc *rcfile, gint num, t_quicklauncher *quicklauncher)
{
	char group[15];
	t_launcher *launcher;
	g_sprintf(group, "launcher_%d%c", num,0);
	xfce_rc_set_group(rcfile, group);

	launcher = g_new0 (t_launcher, 1);
	launcher->quicklauncher = quicklauncher;
	launcher->command = g_strdup(xfce_rc_read_entry(rcfile, "command", NULL));
	launcher->icon_name = g_strdup(xfce_rc_read_entry(rcfile, "icon_name", NULL));
	launcher->icon_id = xfce_rc_read_int_entry(rcfile, "icon_id", 0);

	create_launcher(launcher);
	return launcher;
}
Esempio n. 9
0
static void
sample_read (SamplePlugin *sample)
{
  XfceRc      *rc;
  gchar       *file;
  const gchar *value;

  /* get the plugin config file location */
  file = xfce_panel_plugin_save_location (sample->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 */
          value = xfce_rc_read_entry (rc, "setting1", DEFAULT_SETTING1);
          sample->setting1 = g_strdup (value);

          sample->setting2 = xfce_rc_read_int_entry (rc, "setting2", DEFAULT_SETTING2);
          sample->setting3 = xfce_rc_read_bool_entry (rc, "setting3", DEFAULT_SETTING3);

          /* cleanup */
          xfce_rc_close (rc);

          /* leave the function, everything went well */
          return;
        }
    }

  /* something went wrong, apply default values */
  DBG ("Applying default settings");

  sample->setting1 = g_strdup (DEFAULT_SETTING1);
  sample->setting2 = DEFAULT_SETTING2;
  sample->setting3 = DEFAULT_SETTING3;
}
Esempio n. 10
0
static GSList *
parole_pl_parser_parse_pls (const gchar *filename)
{
    XfceRc *rcfile;
    GSList *list = NULL;
    ParoleFile *file;
    const gchar *file_entry, *title_entry;
    guint i, nentries;
    gchar key[128];

    rcfile = xfce_rc_simple_open (filename, TRUE);

    if ( xfce_rc_has_group (rcfile, "playlist") ) 
    {
        xfce_rc_set_group (rcfile, "playlist");
        
        nentries = xfce_rc_read_int_entry (rcfile, "NumberOfEntries", 0);

        for (i = 1; i <= nentries; i++) 
	{
            g_snprintf (key, 128, "File%d", i);
	    
            file_entry = xfce_rc_read_entry (rcfile, key, NULL);
	    
            if (!file_entry)
                continue;
	    
	    g_snprintf (key, 128, "Title%d", i);
	    
            title_entry = xfce_rc_read_entry (rcfile, key, NULL);
	    
	    file = parole_file_new_with_display_name (file_entry, title_entry);
	    list = g_slist_append (list, file);
	}
    }
    
    xfce_rc_close (rcfile);
    
    return list;
}
Esempio n. 11
0
/* Internal: Load command config file */
void
_verve_db_load_rc (VerveDb *db, const gchar *filename)
{
  XfceRc *rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, filename, FALSE);
  
  g_return_if_fail (xfce_rc_has_entry (rc, "Type"));

  /* Get command type */
  gint cmd_type = xfce_rc_read_int_entry (rc, "Type", VERVE_COMMAND_TYPE_SIMPLE);
  
  switch (cmd_type)
  {
    case VERVE_COMMAND_TYPE_SCRIPT:
      _verve_db_load_script_rc (db, rc);
      break;
    
    case VERVE_COMMAND_TYPE_SIMPLE:
      _verve_db_load_simple_rc (db, rc);
      break;
  }

  xfce_rc_close (rc);
}
Esempio n. 12
0
static void
migrate_46_plugin_separator (XfconfChannel *channel,
                             XfceRc        *rc)
{
  gint  type;
  guint style;

  if (!xfce_rc_has_entry (rc, "separator-type"))
    return;

  type = xfce_rc_read_int_entry (rc, "separator-type", 0);
  switch (type)
    {
    case 0: /* SEP_SPACE */
      style = 0; /* SEPARATOR_PLUGIN_STYLE_TRANSPARENT */
      break;

    case 1: /* SEP_EXPAND */
      style = 0; /* SEPARATOR_PLUGIN_STYLE_TRANSPARENT */
      xfconf_channel_set_bool (channel, "/expand", TRUE);
      break;

    case 2: /* SEP_LINE */
      style = 1; /* SEPARATOR_PLUGIN_STYLE_SEPARATOR */
      break;

    case 3: /* SEP_HANDLE */
      style = 2; /* SEPARATOR_PLUGIN_STYLE_HANDLE */
      break;

    default: /* SEP_DOTS */
      style = 3; /* SEPARATOR_PLUGIN_STYLE_DOTS */
      break;
    }

  xfconf_channel_set_uint (channel, "/style", style);
}
Esempio n. 13
0
static void
migrate_46_plugin_clock (XfconfChannel *channel,
                         XfceRc        *rc)
{
  gint type;

  if (xfce_rc_has_entry (rc, "ClockType"))
    {
      type = xfce_rc_read_int_entry (rc, "ClockType", 0);
      if (type == 4) /* XFCE_CLOCK_LCD */
        type++; /* Skip CLOCK_PLUGIN_MODE_FUZZY */
      xfconf_channel_set_uint (channel, "/mode", type);
    }

  migrate_46_plugin_string ("DigitalFormat", "digital-format", "%R");
  migrate_46_plugin_string ("TooltipFormat", "tooltip-format", "%A %d %B %Y");

  migrate_46_plugin_bool ("ShowFrame", "show-frame", TRUE);
  migrate_46_plugin_bool ("ShowSeconds", "show-seconds", FALSE);
  migrate_46_plugin_bool ("ShowMilitary", "show-military", FALSE);
  migrate_46_plugin_bool ("ShowMeridiem", "show-meridiem", TRUE);
  migrate_46_plugin_bool ("FlashSeparators", "flash-separators", FALSE);
  migrate_46_plugin_bool ("TrueBinary", "true-binary", FALSE);
}
Plugin::Plugin(XfcePanelPlugin *xfce_plugin_)
  : xfce_plugin(xfce_plugin_),

  // Setting defaults
  icon_path("/usr/share/pixmaps/xfce4-hardware-monitor-plugin.png"),
  viewer_type("curve"),
  viewer_font(""),
  viewer_size(96),  // Arbitrary default, see later in this function for notes
  background_color(0x000000FF),  // Black as the night - note that the
                                 // transparency bits need to be set to max to
                                 // ensure the colour is visible
  use_background_color(false),
  next_color(0),
  viewer_text_overlay_enabled(false),
  viewer_text_overlay_format_string("%a %m"),
  viewer_text_overlay_separator(" "),
  viewer_text_overlay_font(""),
  viewer_text_overlay_use_font(false),
  viewer_text_overlay_color(0x000000FF),
  viewer_text_overlay_position(CanvasView::top_left),
  viewer_monitor_type_sync_enabled(true)
{
  // Search for settings file
  XfceRc* settings_ro = NULL;
  gchar* file = xfce_panel_plugin_lookup_rc_file(xfce_plugin);
  
  if (file)
  {
    // One exists - loading settings
    settings_ro = xfce_rc_simple_open(file, true);
    g_free(file);

    // Ensuring default group is in focus
    xfce_rc_set_group(settings_ro, NULL);

    icon_path = xfce_rc_read_entry(settings_ro, "icon-path", icon_path.c_str());
    viewer_type = xfce_rc_read_entry(settings_ro, "viewer_type",
      viewer_type.c_str());
    viewer_size = xfce_rc_read_int_entry(settings_ro, "viewer_size",
      viewer_size);
    viewer_font = xfce_rc_read_entry(settings_ro, "viewer_font",
      viewer_font.c_str());
    background_color = xfce_rc_read_int_entry(settings_ro, "background_color",
      background_color);
    use_background_color = xfce_rc_read_bool_entry(settings_ro,
      "use_background_color", use_background_color);
    next_color = xfce_rc_read_int_entry(settings_ro, "next_color",
      next_color);
    viewer_text_overlay_enabled = xfce_rc_read_bool_entry(settings_ro,
      "viewer_text_overlay_enabled", viewer_text_overlay_enabled);
    viewer_text_overlay_format_string = xfce_rc_read_entry(settings_ro,
      "viewer_text_overlay_format_string",
      viewer_text_overlay_format_string.c_str());
    viewer_text_overlay_separator = xfce_rc_read_entry(settings_ro,
      "viewer_text_overlay_separator", viewer_text_overlay_separator.c_str());
    viewer_text_overlay_font = xfce_rc_read_entry(settings_ro,
      "viewer_text_overlay_font", viewer_text_overlay_font.c_str());
    viewer_text_overlay_color = xfce_rc_read_int_entry(settings_ro,
      "viewer_text_overlay_color", viewer_text_overlay_color);
    viewer_monitor_type_sync_enabled = xfce_rc_read_bool_entry(settings_ro,
      "viewer_monitor_type_sync_enabled", viewer_monitor_type_sync_enabled);

    // Enum is validated in set_viewer_text_overlay_position
    CanvasView::TextOverlayPosition text_overlay_position =
        static_cast<CanvasView::TextOverlayPosition>(
          xfce_rc_read_int_entry(settings_ro, "viewer_text_overlay_position",
                                 CanvasView::top_left));
    set_viewer_text_overlay_position(text_overlay_position);
  }
  
  // Loading icon
  try
  {
    icon = Gdk::Pixbuf::create_from_file(icon_path);
  }
  catch (...)
  {
    std::cerr <<
      String::ucompose(_("Hardware Monitor: cannot load the icon '%1'.\n"),
          icon_path);

    // It's a minor problem if we can't find the icon
    icon = Glib::RefPtr<Gdk::Pixbuf>();
  }

  // Configuring viewer type
  viewer_type_listener(viewer_type);

  /* Actually setting the viewer size has no effect in this function -
   * seems that it needs to be done in or after the mainloop kicks off */

  // Loading up monitors
  /* Plugin& is initialised from non-transient address of this ('this' itself
   * is an rvalue so not allowed for a reference) */
  monitor_seq mon = load_monitors(settings_ro, *this);
  for (monitor_iter i = mon.begin(), end = mon.end(); i != end; ++i)
    add_monitor(*i);

  // All settings loaded
  if (settings_ro)
    xfce_rc_close(settings_ro);

  /* Connect plugin signals to functions - since I'm not really interested
   * in the plugin but the plugin pointer, swapped results in the signal
   * handler getting the plugin reference first - the plugin pointer is
   * passed next, but since the handler only takes one parameter this is
   * discarded
   * Providing About option */
  g_signal_connect_swapped(xfce_plugin, "about", G_CALLBACK(display_about),
    this);

  // Hooking into Properties option
  g_signal_connect_swapped(xfce_plugin, "configure-plugin",
    G_CALLBACK(display_preferences), this);

  // Hooking into plugin destruction signal
  g_signal_connect_swapped(xfce_plugin, "free-data", G_CALLBACK(plugin_free),
    this);

  // Hooking into save signal
  g_signal_connect_swapped(xfce_plugin, "save", G_CALLBACK(save_monitors),
    this);

  /* Not needed as the canvas resizes on the fly
  // Hooking into size changed signal
  g_signal_connect(xfce_plugin, "size-changed", G_CALLBACK(size_changed),
    this);
  */

  // Adding configure and about to the plugin's right-click menu
  xfce_panel_plugin_menu_show_configure(xfce_plugin);
  xfce_panel_plugin_menu_show_about(xfce_plugin);

  /* Add plugin to panel - I need to turn the Plugin (which inherits from
   * Gtk::EventBox) into a GtkWidget* - to do this I get at the GObject
   * pointer underneath the gtkmm layer */
  gtk_container_add(GTK_CONTAINER(xfce_plugin), GTK_WIDGET(this->gobj()));

  // Initialising timer to run every second (by default) to trigger main_loop
  timer =
    Glib::signal_timeout().connect(sigc::mem_fun(*this, &Plugin::main_loop),
      update_interval);

  // Initial main_loop run
  main_loop();
}
Esempio n. 15
0
static void
time_out_load_settings (TimeOutPlugin *time_out)
{
  XfceRc  *rc;
  gchar   *filename;

  /* Default settings */
  gint     break_countdown_seconds = DEFAULT_BREAK_COUNTDOWN_SECONDS;
  gint     lock_countdown_seconds = DEFAULT_LOCK_COUNTDOWN_SECONDS;
  gint     postpone_countdown_seconds = DEFAULT_POSTPONE_COUNTDOWN_SECONDS;
  gboolean enabled = DEFAULT_ENABLED;
  gboolean display_seconds = DEFAULT_DISPLAY_SECONDS;
  gboolean display_hours = DEFAULT_DISPLAY_HOURS;
  gboolean display_time = DEFAULT_DISPLAY_TIME;
  gboolean display_icon = DEFAULT_DISPLAY_ICON;
  gboolean allow_postpone = DEFAULT_ALLOW_POSTPONE;
  gboolean auto_resume = DEFAULT_AUTO_RESUME;;

  g_return_if_fail (time_out != NULL);

  /* Search for the config file */
  filename = xfce_panel_plugin_save_location (time_out->plugin, FALSE);

  /* Only try to read the file if it exists */
  if (G_LIKELY (filename != NULL))
    {
      /* Open file handle */
      rc = xfce_rc_simple_open (filename, TRUE);

      /* Check if the file could be opened */
      if (G_LIKELY (rc != NULL))
        {
          /* Read settings */
          break_countdown_seconds = xfce_rc_read_int_entry (rc, "break-countdown-seconds", break_countdown_seconds);
          lock_countdown_seconds = xfce_rc_read_int_entry (rc, "lock-countdown-seconds", lock_countdown_seconds);
          postpone_countdown_seconds = xfce_rc_read_int_entry (rc, "postpone-countdown-seconds", postpone_countdown_seconds);
          enabled = xfce_rc_read_bool_entry (rc, "enabled", enabled);
          display_seconds = xfce_rc_read_bool_entry (rc, "display-seconds", display_seconds);
          display_hours = xfce_rc_read_bool_entry (rc, "display-hours", display_hours);
          display_time = xfce_rc_read_bool_entry (rc, "display-time", display_time);
          display_icon = xfce_rc_read_bool_entry (rc, "display-icon", display_icon);
          allow_postpone = xfce_rc_read_bool_entry (rc, "allow-postpone", allow_postpone);
          auto_resume = xfce_rc_read_bool_entry (rc, "auto-resume", auto_resume);

          /* Close file handle */
          xfce_rc_close (rc);
        }

      /* Free filename */
      g_free (filename);
    }

  /* Apply settings */
  time_out->break_countdown_seconds = break_countdown_seconds;
  time_out->lock_countdown_seconds = lock_countdown_seconds;
  time_out->postpone_countdown_seconds = postpone_countdown_seconds;
  time_out->enabled = enabled;
  time_out->display_seconds = display_seconds;
  time_out->display_hours = display_hours;
  time_out->display_time = display_time;
  time_out->display_icon = display_icon;
  time_out->allow_postpone = allow_postpone;
  time_out->auto_resume = auto_resume;
}
Esempio n. 16
0
static void windowck_read(WindowckPlugin *wckp)
{
    XfceRc *rc;
    gchar *file;
    const gchar *title_font;

    /* allocate memory for the preferences structure */
    wckp->prefs = g_slice_new0(WCKPreferences);

    /* get the plugin config file location */
    file = xfce_panel_plugin_save_location(wckp->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 */
            wckp->prefs->only_maximized = xfce_rc_read_bool_entry(rc, "only_maximized", DEFAULT_ONLY_MAXIMIZED);
            wckp->prefs->show_on_desktop = xfce_rc_read_bool_entry(rc, "show_on_desktop", DEFAULT_SHOW_ON_DESKTOP);
            wckp->prefs->show_icon = xfce_rc_read_bool_entry(rc, "show_icon", DEFAULT_SHOW_ICON);
            wckp->prefs->icon_on_right = xfce_rc_read_bool_entry(rc, "icon_on_right", DEFAULT_ICON_ON_RIGHT);
            wckp->prefs->show_window_menu = xfce_rc_read_bool_entry(rc, "show_window_menu", DEFAULT_SHOW_WINDOW_MENU);
            wckp->prefs->hide_title = xfce_rc_read_bool_entry(rc, "hide_title", DEFAULT_HIDE_TITLE);
            wckp->prefs->full_name = xfce_rc_read_bool_entry(rc, "full_name", DEFAULT_FULL_NAME);
            wckp->prefs->show_tooltips = xfce_rc_read_bool_entry(rc, "show_tooltips", DEFAULT_SHOW_TOOLTIPS);
            wckp->prefs->size_mode = xfce_rc_read_int_entry (rc, "size_mode", DEFAULT_SIZE_MODE);
            wckp->prefs->title_size = xfce_rc_read_int_entry(rc, "title_size", DEFAULT_TITLE_SIZE);
            wckp->prefs->custom_font = xfce_rc_read_bool_entry(rc, "custom_font", DEFAULT_CUSTOM_FONT);
            title_font = xfce_rc_read_entry(rc, "title_font", DEFAULT_TITLE_FONT);
            wckp->prefs->title_font = g_strdup(title_font);
            wckp->prefs->title_alignment = xfce_rc_read_int_entry(rc, "title_alignment", DEFAULT_TITLE_ALIGNMENT);
            wckp->prefs->title_padding = xfce_rc_read_int_entry(rc, "title_padding", DEFAULT_TITLE_PADDING);

            /* cleanup */
            xfce_rc_close(rc);

            /* leave the function, everything went well */
            return;
        }
    }

    /* something went wrong, apply default values */
    DBG("Applying default settings");

    wckp->prefs->only_maximized = DEFAULT_ONLY_MAXIMIZED;
    wckp->prefs->show_on_desktop = DEFAULT_SHOW_ON_DESKTOP;
    wckp->prefs->show_icon = DEFAULT_SHOW_ICON;
    wckp->prefs->icon_on_right = DEFAULT_ICON_ON_RIGHT;
    wckp->prefs->show_window_menu = DEFAULT_SHOW_WINDOW_MENU;
    wckp->prefs->hide_title = DEFAULT_HIDE_TITLE;
    wckp->prefs->full_name = DEFAULT_FULL_NAME;
    wckp->prefs->show_tooltips = DEFAULT_SHOW_TOOLTIPS;
    wckp->prefs->size_mode = DEFAULT_SIZE_MODE;
    wckp->prefs->title_size = DEFAULT_TITLE_SIZE;
    wckp->prefs->custom_font = DEFAULT_CUSTOM_FONT;
    wckp->prefs->title_font = DEFAULT_TITLE_FONT;
    wckp->prefs->title_alignment = DEFAULT_TITLE_ALIGNMENT;
    wckp->prefs->title_padding = DEFAULT_TITLE_PADDING;
}
Esempio n. 17
0
static void
clipman_read (ClipmanPlugin *clipman)
{
    XfceRc      *rc;
    gchar       *file;
    guint        type, i, clipslen;
    gchar        name[13];
    const gchar *value;
    
    /* Because Clipman is unique, we use 1 config file */
    /*
    file = xfce_panel_plugin_save_location (clipman->plugin, FALSE);
    DBG("Read from file: %s", file);
    */
    
    file = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "xfce4/panel/clipman.rc", TRUE);

    if (G_UNLIKELY (!file))
        return;
    
    rc = xfce_rc_simple_open (file, FALSE);
    g_free (file);
    
    xfce_rc_set_group (rc, "Properties");
    
    clipman->ExitSave         = xfce_rc_read_bool_entry (rc, "ExitSave",     DEFEXITSAVE);
    clipman->IgnoreSelect     = xfce_rc_read_bool_entry (rc, "IgnoreSelect", DEFIGNORESELECT);
    clipman->PreventEmpty     = xfce_rc_read_bool_entry (rc, "PreventEmpty", DEFPREVENTEMPTY);
    
    switch (xfce_rc_read_int_entry (rc, "Behaviour", DEFBEHAVIOUR))
    {
        case 1:
            clipman->Behaviour = NORMAL;
            DBG ("Behaviour = NORMAL");
            break;
        case 2:
            clipman->Behaviour = STRICTLY;
            DBG ("Behaviour = STRICTLY");
            break;
    }
    
    clipman->ItemNumbers      = xfce_rc_read_bool_entry (rc, "ItemNumbers",    DEFITEMNUMBERS);
    clipman->SeparateMenu     = xfce_rc_read_bool_entry (rc, "SeparateMenu",   DEFSEPMENU);
    
    clipman->HistoryItems     = xfce_rc_read_int_entry  (rc, "HistoryItems",   DEFHISTORY);
    clipman->MenuCharacters   = xfce_rc_read_int_entry  (rc, "MenuCharacters", DEFCHARS);
    
    if (clipman->HistoryItems > MAXHISTORY)
        clipman->HistoryItems = MAXHISTORY;
    if (clipman->HistoryItems < MINHISTORY)
        clipman->HistoryItems = MINHISTORY;
    
    if (clipman->MenuCharacters > MAXCHARS)
        clipman->MenuCharacters = MAXCHARS;
    if (clipman->MenuCharacters < MINCHARS)
        clipman->MenuCharacters = MINCHARS;
    
    xfce_rc_set_group (rc, "Clips");
    clipslen = xfce_rc_read_int_entry (rc, "ClipsLen", 0);
    
    if (clipslen > MAXHISTORY)
        clipslen = MAXHISTORY;
    
    if (clipman->ExitSave && 
        clipslen > 0
       )
    {
        DBG("Restoring the clipboard");
        
        for (i = 0; i < clipslen; ++i)
        {
            g_snprintf (name, 13, "clip_%d_text", i);
            value = xfce_rc_read_entry (rc, name, "");
            
            g_snprintf (name, 13, "clip_%d_from", i);
            type = xfce_rc_read_int_entry (rc, name, 0);
            
            if (type == 0)
                clipman_add_clip (clipman, (gchar *)value, PRIMARY);
            else
                clipman_add_clip (clipman, (gchar *)value, DEFAULT);
        }
    }
    
    xfce_rc_close (rc);
}
Esempio n. 18
0
void
multiload_ps_settings_get_int(gpointer settings, const gchar *key, int *destination)
{
	*destination = xfce_rc_read_int_entry((XfceRc*)settings, key, *destination);
}