Back to index

im-sdk  12.3.91
Classes | Defines | Enumerations | Functions | Variables
im_settings_daemon.c File Reference
#include <config.h>
#include "status-placement.h"
#include <string.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <gtk/gtk.h>
#include <gnome.h>
#include <gconf/gconf-client.h>
#include <stdarg.h>

Go to the source code of this file.

Classes

struct  IMSettings

Defines

#define IM_KEY_DIR   "/desktop/gnome/input_methods"
#define ENABLE_IM_KEY   IM_KEY_DIR "/support"
#define ENABLE_STATUS_KEY   IM_KEY_DIR "/status"
#define ENABLE_LOOKUP_KEY   IM_KEY_DIR "/lookup"
#define STATUS_PLACEMENT_KEY   IM_KEY_DIR "/status_placement"
#define GTK_STATUS_STYLE_KEY   "/desktop/gnome/interface/gtk-im-status-style"

Enumerations

enum  IMEnabled {
  IM_OFF = 0, IM_ON, IM_OFF = 0, IM_ON,
  IM_OFF = 0, IM_ON, IM_OFF = 0, IM_ON
}

Functions

static void set_im_settings_property ()
static void setup ()
int main (int argc, char *argv[])

Variables

static const char * disabled = "disabled"
static IMSettings current_setting
static GdkAtom im_settings_atom = GDK_NONE
static const char * _IM_SETTINGS = "_IM_SETTINGS"

Class Documentation

struct IMSettings

Definition at line 47 of file im_settings_daemon.c.

Class Members
IMEnabled im_enabled
IMEnabled lookup_enabled
IMEnabled status_enabled
IMStatusPlacement status_placement

Define Documentation

#define ENABLE_IM_KEY   IM_KEY_DIR "/support"

Definition at line 33 of file im_settings_daemon.c.

#define ENABLE_LOOKUP_KEY   IM_KEY_DIR "/lookup"

Definition at line 35 of file im_settings_daemon.c.

#define ENABLE_STATUS_KEY   IM_KEY_DIR "/status"

Definition at line 34 of file im_settings_daemon.c.

#define GTK_STATUS_STYLE_KEY   "/desktop/gnome/interface/gtk-im-status-style"

Definition at line 37 of file im_settings_daemon.c.

#define IM_KEY_DIR   "/desktop/gnome/input_methods"

Definition at line 32 of file im_settings_daemon.c.

#define STATUS_PLACEMENT_KEY   IM_KEY_DIR "/status_placement"

Definition at line 36 of file im_settings_daemon.c.


Enumeration Type Documentation

enum IMEnabled
Enumerator:
IM_OFF 
IM_ON 
IM_OFF 
IM_ON 
IM_OFF 
IM_ON 
IM_OFF 
IM_ON 

Definition at line 39 of file im_settings_daemon.c.

             {
  IM_OFF = 0,
  IM_ON
} IMEnabled;

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 150 of file im_settings_daemon.c.

{
  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  gnome_program_init ("gnome-im-settings-daemon", VERSION,
                    LIBGNOMEUI_MODULE, argc, argv,
                    GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
                    NULL);
  setup ();

  return 0;
}

Here is the call graph for this function:

static void set_im_settings_property ( ) [static]

Definition at line 59 of file im_settings_daemon.c.

{
  GdkWindow *root_window = gdk_get_default_root_window ();

  if (im_settings_atom == GDK_NONE)
    im_settings_atom = gdk_atom_intern (_IM_SETTINGS, FALSE);
  if (im_settings_atom == GDK_NONE)
    return;

  gdk_property_change (root_window,
                     im_settings_atom, im_settings_atom,
                     8, GDK_PROP_MODE_REPLACE,
                     (guchar *)&current_setting, sizeof (IMSettings));

  {
    GdkAtom  type;
    guchar   *data = NULL;
    gint     format;
    gint     length = 0;
    gdk_property_get (root_window,
                    im_settings_atom, im_settings_atom,
                    0, INT_MAX, FALSE,
                    &type, &format, &length, &data);
    if (data)
      {
       IMSettings *new_settings = (IMSettings*)data;

       g_printf ("GNOME_IM_ENABLED=%s\n",
                new_settings->im_enabled == IM_ON ? "yes" : "no");
       g_printf ("GNOME_IM_STATUS_ENABLED=%s\n", 
                new_settings->status_enabled == IM_ON ? "yes" : "no");
       g_printf ("GNOME_IM_LOOKUP_ENABLED=%s\n",
                new_settings->lookup_enabled == IM_ON ? "yes" : "no");
       g_printf ("GNOME_IM_STATUS_PLACEMENT=%s\n",
                new_settings->status_placement ? "application" : "panel");
       g_free (data);
      }
  }
}

Here is the caller graph for this function:

static void setup ( ) [static]

Definition at line 101 of file im_settings_daemon.c.

{
  GConfClient *client;
  gboolean im_enabled, status_enabled, lookup_enabled;
  char *str = NULL;

  client = gconf_client_get_default ();

  str = NULL;
  str = gconf_client_get_string (client,
                             ENABLE_IM_KEY, NULL);
  if (str && strcmp (str, disabled) == 0)
    im_enabled = FALSE;
  else
    im_enabled = TRUE;
  g_free (str);

  str = NULL;
  str = gconf_client_get_string (client,
                             ENABLE_STATUS_KEY, NULL);
  if (str && strcmp (str, disabled) == 0)
    status_enabled = FALSE;
  else
    status_enabled = TRUE;
  g_free (str);

  str = NULL;
  str = gconf_client_get_string (client,
                             ENABLE_LOOKUP_KEY, NULL);
  if (str && strcmp (str, disabled) == 0)
    lookup_enabled = FALSE;
  else
    lookup_enabled = TRUE;
  g_free (str);

  current_setting.im_enabled = im_enabled ? IM_ON : IM_OFF;
  current_setting.status_enabled = status_enabled ? IM_ON : IM_OFF;
  current_setting.lookup_enabled = lookup_enabled ? IM_ON : IM_OFF;

  str = NULL;
  str = gconf_client_get_string (client,
                             STATUS_PLACEMENT_KEY, NULL);
  current_setting.status_placement = gimlet_status_placement (str);
  g_free (str);

  set_im_settings_property ();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char* _IM_SETTINGS = "_IM_SETTINGS" [static]

Definition at line 56 of file im_settings_daemon.c.

Definition at line 54 of file im_settings_daemon.c.

const char* disabled = "disabled" [static]

Definition at line 45 of file im_settings_daemon.c.

GdkAtom im_settings_atom = GDK_NONE [static]

Definition at line 55 of file im_settings_daemon.c.