Exemplo n.º 1
0
/* Internal: Load script (enhanced) command from config */
void 
_verve_db_load_script_rc (VerveDb *db, const XfceRc *rc)
{
  g_return_if_fail (xfce_rc_has_entry (rc, "Target"));
  g_return_if_fail (xfce_rc_has_entry (rc, "Shell"));
    
  /* Get basename of target */
  const gchar *basename = xfce_rc_read_entry (rc, "Target", NULL);
    
  /* Get resource path */
  gchar *resource = g_build_filename (g_get_application_name (), basename, NULL);
    
  /* Get absolute filename */
  gchar *filename = xfce_resource_lookup (XFCE_RESOURCE_DATA, resource);
    
  VerveScriptCommand *cmd;
  cmd = (VerveScriptCommand *)malloc (sizeof (VerveScriptCommand));
  cmd->name = g_strdup (xfce_rc_read_entry (rc, "Name", NULL));
  cmd->shell = g_strdup (xfce_rc_read_entry (rc, "Shell", "sh"));
  cmd->target_filename = g_strdup (filename);
      
  g_hash_table_insert (db->script_commands, (gpointer) cmd->name, (gpointer) cmd);
    
  g_free (resource);
  g_free (filename);
}
Exemplo n.º 2
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);
}
Exemplo n.º 3
0
/* Load simple ('one line') command from config */
void
_verve_db_load_simple_rc (VerveDb *db, XfceRc *rc)
{
  g_return_if_fail (xfce_rc_has_entry (rc, "Command"));
    
  VerveSimpleCommand *cmd;
  cmd = (VerveSimpleCommand *)malloc (sizeof (VerveSimpleCommand));
  cmd->name = xfce_rc_read_entry (rc, "Name", NULL);
  cmd->command = xfce_rc_read_entry (rc, "Command", "");

  g_hash_table_insert (db->simple_commands, (gpointer) cmd->name, (gpointer) cmd);
}
Exemplo n.º 4
0
static void
migrate_46_plugin_heartlenv_menu (XfconfChannel *channel,
                              XfceRc        *rc)
{
  migrate_46_plugin_bool ("show_menu_icons", "show-menu-icons", TRUE);
  migrate_46_plugin_bool ("show_button_title", "show-button-title", TRUE);
  migrate_46_plugin_string ("menu_file", "custom-menu-file", "");
  migrate_46_plugin_string ("icon_file", "button-icon", "heartlenv-panel-menu");
  migrate_46_plugin_string ("button_title", "button-title", "");

  if (xfce_rc_has_entry (rc, "use_default_menu"))
    xfconf_channel_set_bool (channel, "/custom-menu",
       !xfce_rc_read_bool_entry (rc, "use_default_menu", TRUE));
}
Exemplo n.º 5
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); */
}
Exemplo n.º 6
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);
}
Exemplo n.º 7
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);
}
Exemplo n.º 8
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);
}
Exemplo n.º 9
0
static void
initialize (int argc, char **argv)
{
  gboolean disable_tcp = FALSE;
  GdkDisplay *dpy;
  XfceRc *rc;
  
  for (++argv; --argc > 0; ++argv)
    {
      if (strcmp (*argv, "--version") == 0)
        {
          printf ("%s (Xfce %s)\n\n"
                  "Copyright (c) 2003-2006\n"
                  "        The Xfce development team. All rights reserved.\n\n"
                  "Written for Xfce by Benedikt Meurer <*****@*****.**>.\n\n"
                  "Built with Gtk+-%d.%d.%d, running with Gtk+-%d.%d.%d.\n\n"
                  "Please report bugs to <%s>.\n",
                  PACKAGE_STRING, xfce_version_string (),
                  GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
                  gtk_major_version, gtk_minor_version, gtk_micro_version,
                  PACKAGE_BUGREPORT);
          exit (EXIT_SUCCESS);
        }
      else if (strcmp (*argv, "--disable-tcp") == 0)
        {
          disable_tcp = TRUE;
        }
      else
        {
          usage (strcmp (*argv, "--help") == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
        }
    }

  setup_environment ();

  rc = xfsm_open_config (TRUE);

  dpy = gdk_display_get_default ();
  init_display (dpy, rc, disable_tcp);

  /* verify that the DNS settings are ok */
  xfsm_splash_screen_next (splash_screen, _("Verifying DNS settings"));
  xfsm_dns_check ();

  xfsm_splash_screen_next (splash_screen, _("Loading session data"));

  xfce_rc_set_group (rc, "Compatibility");
  compat_gnome = xfce_rc_read_bool_entry (rc, "LaunchGnome", FALSE);
  compat_kde = xfce_rc_read_bool_entry (rc, "LaunchKDE", FALSE);

  xfce_rc_set_group (rc, "General");
  xfsm_startup_init (rc);
  xfsm_manager_init (rc);

  /* cleanup obsolete entries */
  xfce_rc_set_group (rc, "General");
  if (xfce_rc_has_entry (rc, "ConfirmLogout"))
    xfce_rc_delete_entry (rc, "ConfirmLogout", FALSE);
  if (xfce_rc_has_entry (rc, "AlwaysDisplayChooser"))
    xfce_rc_delete_entry (rc, "AlwaysDisplayChooser", FALSE);
  xfce_rc_delete_group (rc, "Splash Theme", FALSE);

  xfce_rc_close (rc);
}