static void
desktop_set_metadata_string (GFile *file,
                             const char *key,
                             const char *string)
{
    MateConfClient *client;
    char *mateconf_key;
    GFile *parent;
    char *name;

    parent = g_file_get_parent (file);
    if (parent == NULL)
    {
        name = g_strdup ("directory");
    }
    else
    {
        g_object_unref (parent);
        name = g_file_get_basename (file);
    }

    client = mateconf_client_get_default ();
    mateconf_key = get_metadata_mateconf_path (name, key);

    mateconf_client_set_string (client, mateconf_key, string, NULL);

    g_free (mateconf_key);
    g_free (name);
    g_object_unref (client);
}
/**
 * mateui_mateconf_lazy_init:
 *
 * Description:  Internal libmate/ui routine.  You never have
 * to do this from your code.  But all places in libmate/ui
 * that need mateconf should call this before calling any mateconf
 * calls.
 **/
void
_mateui_mateconf_lazy_init (void)
{
	/* Note this is the same as in libmate/libmate/mate-mateconf.c, keep
	 * this in sync (it's called mate_mateconf_lazy_init) */
        gchar *settings_dir;
	MateConfClient* client = NULL;
	static gboolean initialized = FALSE;

	if (initialized)
		return;

	initialized = TRUE;

        client = mateconf_client_get_default ();

        mateconf_client_add_dir (client,
			      "/desktop/mate",
			      MATECONF_CLIENT_PRELOAD_NONE, NULL);

        settings_dir = mate_mateconf_get_mate_libs_settings_relative ("");

        mateconf_client_add_dir (client,
			      settings_dir,
			      /* Possibly we should turn preload on for this */
			      MATECONF_CLIENT_PRELOAD_NONE,
			      NULL);
        g_free (settings_dir);

        /* Leak the MateConfClient reference, we want to keep
         * the client alive forever.
         */
}
void
mateconf_bookmarks_add_bookmark (const char *path)
{
	GSList *list, *tmp;
	MateConfClient *client;

	client = mateconf_client_get_default ();

	/* Get the old list and then set it */
	list = mateconf_client_get_list (client,
				     "/apps/mateconf-editor/bookmarks", MATECONF_VALUE_STRING, NULL);

	/* FIXME: We need error handling here, also this function leaks memory */

	/* Check that the bookmark hasn't been added already */
	for (tmp = list; tmp; tmp = tmp->next) {
		if (strcmp (tmp->data, path) == 0) {
			g_slist_free (list);
			return;
		}
	}

	/* Append the new bookmark */
	list = g_slist_append (list, g_strdup (path));
	
	mateconf_client_set_list (client,
			       "/apps/mateconf-editor/bookmarks", MATECONF_VALUE_STRING, list, NULL);
	g_slist_free (list);
	g_object_unref (client);
}
예제 #4
0
static void
gn_combo_history_mateconf_register_id (GnComboHistory *history)
{
	gchar *key;
	   
	g_return_if_fail (GN_IS_COMBO_HISTORY (history));

	if (!history->priv->mateconf_client)
		history->priv->mateconf_client = mateconf_client_get_default ();

	key = g_strconcat ("/apps/mate-settings/",
			  "mate-nettool",
			   "/history-",
			   history->priv->id,
			   NULL);

	mateconf_client_add_dir (history->priv->mateconf_client,
			      key,	MATECONF_CLIENT_PRELOAD_NONE,
			      NULL);
	   
	history->priv->mateconf_notify = mateconf_client_notify_add (
							       history->priv->mateconf_client, key,
							       gn_on_mateconf_history_changed,
							       (gpointer) history, NULL, NULL);

	g_free (key);
}
static gboolean
impl_activate (IdolPlugin *plugin,
	       IdolObject *idol,
	       GError **error)
{
	IdolScreensaverPlugin *pi = IDOL_SCREENSAVER_PLUGIN (plugin);
	MateConfClient *gc;

	pi->bvw = BACON_VIDEO_WIDGET (idol_get_video_widget (idol));

	gc = mateconf_client_get_default ();
	mateconf_client_add_dir (gc, MATECONF_PREFIX,
			      MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
	pi->handler_id_mateconf = mateconf_client_notify_add (gc, MATECONF_PREFIX"/lock_screensaver_on_audio",
							(MateConfClientNotifyFunc) lock_screensaver_on_audio_changed_cb,
							plugin, NULL, NULL);
	g_object_unref (gc);

	pi->handler_id_playing = g_signal_connect (G_OBJECT (idol),
						   "notify::playing",
						   G_CALLBACK (property_notify_cb),
						   pi);
	pi->handler_id_metadata = g_signal_connect (G_OBJECT (pi->bvw),
						    "got-metadata",
						    G_CALLBACK (got_metadata_cb),
						    pi);

	pi->idol = g_object_ref (idol);

	/* Force setting the current status */
	idol_screensaver_update_from_state (idol, pi);

	return TRUE;
}
예제 #6
0
static gboolean
trash_empty_require_confirmation (void)
{
  return mateconf_client_get_bool (mateconf_client_get_default (),
                                "/apps/caja/preferences/confirm_trash",
                                NULL);
}
static void
idol_screensaver_update_from_state (IdolObject *idol,
				     IdolScreensaverPlugin *pi)
{
	gboolean lock_screensaver_on_audio, can_get_frames;
	BaconVideoWidget *bvw;
	MateConfClient *gc;

	bvw = BACON_VIDEO_WIDGET (idol_get_video_widget ((Idol *)(idol)));
	gc = mateconf_client_get_default ();

	lock_screensaver_on_audio = mateconf_client_get_bool (gc, 
							   MATECONF_PREFIX"/lock_screensaver_on_audio",
							   NULL);
	can_get_frames = bacon_video_widget_can_get_frames (bvw, NULL);

	if (idol_is_playing (idol) != FALSE && can_get_frames)
		idol_scrsaver_disable (pi->scr);
	else if (idol_is_playing (idol) != FALSE && !lock_screensaver_on_audio)
		idol_scrsaver_disable (pi->scr);
	else
		idol_scrsaver_enable (pi->scr);

	g_object_unref (gc);
}
예제 #8
0
static void
xfapplet_cleanup_unused_mateconf_keys ()
{
	MateConfClient *client;
	gchar	*dir;
	gchar	*in_use_key;
	int	 i = 0;

	client = mateconf_client_get_default ();
	
	while (1) {
		dir = g_strdup_printf (XFAPPLET_MATECONF_DIR "applet_%d", i++);
		if (mateconf_client_dir_exists (client, dir, NULL)) {
			in_use_key = g_strdup_printf ("%s/in_use", dir);
			if (!mateconf_client_get_bool (client, in_use_key, NULL))
				mateconf_client_recursive_unset (client, dir, MATECONF_UNSET_INCLUDING_SCHEMA_NAMES, NULL);
			g_free (in_use_key);
			g_free (dir);
		}
		else
			break;
	}

	g_object_unref (client);

	g_free (dir);
}
예제 #9
0
gboolean save_current_list(pqi inst)
{
	GError *err = NULL;
	psi iter; char key[16];
	MatePanelApplet *const applet = inst->applet;
	const gchar *fullkey;
	int maxkey = 0;
	
	mate_panel_applet_mateconf_set_int(applet,"mode",inst->mode, &err);
	if (err) return FALSE;
	
	mate_panel_applet_mateconf_set_bool(applet,"show-primary",inst->show_primary,&err);
	
	for (iter = inst->items; iter != NULL; iter = iter->next)
	{
		err = NULL;
		sprintf(key,"file%d",iter->id);
			mate_panel_applet_mateconf_set_string(applet,key,iter->file,&err);
		sprintf(key,"uses%d",iter->id);
			mate_panel_applet_mateconf_set_int(applet,key,iter->uses,&err);
		sprintf(key,"times%d",iter->id);
			mate_panel_applet_mateconf_set_int(applet,key,iter->lastaccess >> 32, &err);
		sprintf(key,"timeu%d",iter->id);
			mate_panel_applet_mateconf_set_int(applet,key,iter->lastaccess & 0xFFFFFFFF, &err);
		if (iter->id >= maxkey)
			maxkey = iter->id + 1;
	}
	sprintf(key,"file%d",maxkey);
	fullkey = mate_panel_applet_mateconf_get_full_key(applet,key);
	mateconf_client_unset(mateconf_client_get_default(),fullkey,NULL);
	return TRUE;
}
MateComponentUIToolbarStyle
matecomponent_ui_preferences_get_toolbar_style (void)
{
	MateComponentUIToolbarStyle style;
	char *str;

	if (!client)
		client = mateconf_client_get_default ();

	style = GTK_TOOLBAR_BOTH;

	str = mateconf_client_get_string (client,
				       "/desktop/mate/interface/toolbar_style",
				       NULL);
	
	if (str != NULL) {
		gint intstyle;

		mateconf_string_to_enum (toolbar_styles,
				      str, &intstyle);

		g_free (str);
		style = intstyle;
	}

	return style;
}
예제 #11
0
/**
 * _mate_vfs_url_show_using_handler_with_env:
 * @url: the url to show
 * @envp: environment for the handler
 * 
 * Same as mate_url_show_using_handler except that the handler
 * will be launched with the given environment.
 *
 * Return value: MATE_VFS_OK on success.
 * MATE_VFS_ERROR_BAD_PAREMETER if the URL is invalid.
 * MATE_VFS_ERROR_NOT_SUPPORTED if no handler is defined.
 * MATE_VFS_ERROR_PARSE if the handler command can not be parsed.
 * MATE_VFS_ERROR_LAUNCH if the handler command can not be launched.
 * MATE_VFS_ERROR_INTERNAL for internal/MateConf errors.
 *
 * Since: 2.4
 */
MateVFSResult
_mate_vfs_url_show_using_handler_with_env (const char  *url,
			                    char       **envp)
{
	MateConfClient *client;
	char *path;
	char *scheme;
	char *template;
	char **argv;
	int argc;
	int i;
	gboolean ret;
	
	g_return_val_if_fail (url != NULL, MATE_VFS_ERROR_BAD_PARAMETERS);
	
	scheme = mate_vfs_get_uri_scheme (url);
	
	g_return_val_if_fail (scheme != NULL, MATE_VFS_ERROR_BAD_PARAMETERS);
	
	if (!mateconf_is_initialized ()) {
		if (!mateconf_init (0, NULL, NULL)) {
			g_free (scheme);
			return MATE_VFS_ERROR_INTERNAL;
		}
	}

	client = mateconf_client_get_default ();
	path = g_strconcat (MATECONF_URL_HANDLER_PATH, scheme, "/command", NULL);
static void
mateconf_bookmarks_dialog_update_mateconf_key (MateConfBookmarksDialog *dialog)
{
	GSList *list;
	GtkTreeIter iter;
	char *bookmark;
	MateConfClient *client;
	
	list = NULL;

	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->list_store), &iter)) {
		do {
			gtk_tree_model_get (GTK_TREE_MODEL (dialog->list_store), &iter,
					    0, &bookmark,
					    -1);
			list = g_slist_append (list, bookmark);
		} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->list_store), &iter));
	}

	client = mateconf_client_get_default ();

	dialog->changing_key = TRUE;
	mateconf_client_set_list (client, BOOKMARKS_KEY,
			       MATECONF_VALUE_STRING, list, NULL);

	g_object_unref (client);
}
static void
mateconf_bookmarks_dialog_populate_model (MateConfBookmarksDialog *dialog)
{
	MateConfClient *client;
	GSList *value_list, *p;
	GtkTreeIter iter;
	
	client = mateconf_client_get_default ();
	
	/* First clear the list store */
	dialog->changing_model = TRUE;
	gtk_list_store_clear (dialog->list_store);

	value_list = mateconf_client_get_list (client, BOOKMARKS_KEY,
					    MATECONF_VALUE_STRING, NULL);

	for (p = value_list; p; p = p->next) {
		gtk_list_store_append (dialog->list_store, &iter);
		gtk_list_store_set (dialog->list_store, &iter,
				    0, p->data,
				    -1);
		g_free (p->data);
	}

	if (value_list)
		g_slist_free (value_list);

	dialog->changing_model = FALSE;

	g_object_unref (client);
}
static void
impl_deactivate	(IdolPlugin *plugin,
		 IdolObject *idol)
{
	IdolScreensaverPlugin *pi = IDOL_SCREENSAVER_PLUGIN (plugin);
	MateConfClient *gc;

	gc = mateconf_client_get_default ();
	mateconf_client_notify_remove (gc, pi->handler_id_mateconf);
	g_object_unref (gc);

	if (pi->handler_id_playing != 0) {
		g_signal_handler_disconnect (G_OBJECT (idol), pi->handler_id_playing);
		pi->handler_id_playing = 0;
	}
	if (pi->handler_id_metadata != 0) {
		g_signal_handler_disconnect (G_OBJECT (pi->bvw), pi->handler_id_metadata);
		pi->handler_id_metadata = 0;
	}

	g_object_unref (pi->idol);
	g_object_unref (pi->bvw);

	idol_scrsaver_enable (pi->scr);
}
예제 #15
0
static void setup_mateconf(PagerData* pager)
{
	MateConfClient* client;
	char* key;

	client = mateconf_client_get_default();

	key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(pager->applet), "num_rows");
	pager->listeners[0] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) num_rows_changed, pager, NULL, NULL);

	g_free(key);


	key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(pager->applet), "display_workspace_names");
	pager->listeners[1] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) display_workspace_names_changed, pager, NULL, NULL);

	g_free(key);

	key = mate_panel_applet_mateconf_get_full_key(MATE_PANEL_APPLET(pager->applet), "display_all_workspaces");
	pager->listeners[2] = mateconf_client_notify_add(client, key, (MateConfClientNotifyFunc) all_workspaces_changed, pager, NULL, NULL);

	g_free(key);

	g_object_unref(G_OBJECT(client));
}
static void
hard_drive_status_tile_init (HardDriveStatusTile * tile)
{
    HardDriveStatusTilePrivate *priv = HARD_DRIVE_STATUS_TILE_GET_PRIVATE (tile);

    priv->mateconf = mateconf_client_get_default ();
    mateconf_client_add_dir (priv->mateconf, TIMEOUT_KEY_DIR, MATECONF_CLIENT_PRELOAD_NONE, NULL);
}
static MateConfClient *
mate_panel_applet_mateconf_get_client (void)
{
	static MateConfClient *client = NULL;

	if (!client)
		client = mateconf_client_get_default ();

	return client;
}
static void
remove_notify_id (gpointer data)
{
	MateConfClient *client;

	client = mateconf_client_get_default ();
	mateconf_client_notify_remove (client, GPOINTER_TO_INT (data));

	g_object_unref (client);
}
/** 
 * mate_vfs_connect_to_server:
 * @uri: The string representation of the server to connect to.
 * @display_name: The display name that is used to identify the server connection.
 * @icon: The icon that is used to identify the server connection.
 *
 * This function adds a server connection to the specified @uri, which is displayed
 * in user interfaces with the specified @display_name and @icon.
 *
 * If this function is invoked successfully, the created server shows up in the
 * list of mounted volumes of the #MateVFSVolumeMonitor, which can be queried
 * using mate_vfs_volume_monitor_get_mounted_volumes().
 *
 * <note>
 * <para>
 * This function does not have a return value. Hence, you can't easily detect
 * whether the specified server was successfully created. The actual creation and
 * consumption of the new server through the #MateVFSVolumeMonitor is done
 * asynchronously.
 * </para>
 * <para>
 * @uri, @display_name, and @icon can be freely chosen, but should be meaningful:
 * </para>
 * <para>
 * @uri should refer to a valid location. You can check the validity of the
 * location by calling mate_vfs_uri_new() with @uri, and checking whether
 * the return value is not %NULL.
 * </para>
 * <para>
 * The @display_name should be queried from the user, and an empty string
 * should not be considered valid.
 * </para>
 * <para>
 * @icon typically references an icon from the icon theme. Some
 * implementations currently use <literal>mate-fs-smb</literal>,
 * <literal>mate-fs-ssh</literal>, <literal>mate-fs-ftp</literal> and
 * <literal>mate-fs-share</literal>, depending on the type of the server
 * referenced by @uri. The icon naming conventions might change in the
 * future, though. Obeying the <ulink
 * url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">
 * freedesktop.org Icon Naming Specification</ulink> is suggested.
 * </para>
 * </note>
 *
 * Since: 2.6
 */
void
mate_vfs_connect_to_server (const char               *uri,
			     const char               *display_name,
			     const char               *icon)
{
	MateConfClient *client;
	GSList *dirs, *l;
	char *dir, *dir_id;
	int max_id, mateconf_id;
	char *key;
	char *id;

	client = mateconf_client_get_default ();

	max_id = 0;
	dirs = mateconf_client_all_dirs (client,
				      CONNECTED_SERVERS_DIR, NULL);
	for (l = dirs; l != NULL; l = l->next) {
		dir = l->data;

		dir_id = strrchr (dir, '/');
		if (dir_id != NULL) {
			dir_id++;
			mateconf_id = strtol (dir_id, NULL, 10);
			max_id = MAX (max_id, mateconf_id);
		}
		
		g_free (dir);
	}
	g_slist_free (dirs);

	id = g_strdup_printf ("%d", max_id + 1);
	
	key = g_strconcat (CONNECTED_SERVERS_DIR "/",
			   id,
			   "/icon", NULL);
	mateconf_client_set_string (client, key, icon, NULL);
	g_free (key);
	
	key = g_strconcat (CONNECTED_SERVERS_DIR "/",
			   id,
			   "/display_name", NULL);
	mateconf_client_set_string (client, key, display_name, NULL);
	g_free (key);

	/* Uri key creation triggers creation, do this last */
	key = g_strconcat (CONNECTED_SERVERS_DIR "/",
			   id,
			   "/uri", NULL);
	mateconf_client_set_string (client, key, uri, NULL);
	g_free (key);
	
	g_free (id);
	g_object_unref (client);
}
예제 #20
0
static GSList *
mc_load_macros (MCData *mc)
{
    MateConfValue *macro_patterns;
    MateConfValue *macro_commands;
    GSList     *macros_list = NULL;
    MateConfClient *client;
    
    client = mateconf_client_get_default ();
    macro_patterns = mateconf_client_get (client,
		    "/apps/mini-commander/macro_patterns", NULL);
    macro_commands = mateconf_client_get (client,
		    "/apps/mini-commander/macro_commands", NULL);
    
    if (macro_patterns && macro_commands) {
    	GSList *patterns;
	GSList *commands;

        patterns = mateconf_value_get_list (macro_patterns);
        commands = mateconf_value_get_list (macro_commands);

	for (; patterns && commands; patterns = patterns->next, commands = commands->next) {
            MateConfValue *v1 = patterns->data;
            MateConfValue *v2 = commands->data;
	    MCMacro    *macro;
            const char *pattern, *command;
            
            pattern = mateconf_value_get_string (v1);
            command = mateconf_value_get_string (v2);

	    if (!(macro = mc_macro_new (pattern, command)))
		continue;

	    macros_list = g_slist_prepend (macros_list, macro);
        }
    } else {    
	int i;

	for (i = 0; i < G_N_ELEMENTS (mc_default_macros); i++)
	    macros_list = g_slist_prepend (macros_list,
					   mc_macro_new (mc_default_macros [i].pattern,
							 mc_default_macros [i].command));
    }

    macros_list = g_slist_reverse (macros_list);

    if (macro_commands)
	mateconf_value_free (macro_commands);

    if (macro_patterns)
	mateconf_value_free (macro_patterns);

    return macros_list;
}
void
mateconf_bookmarks_hook_up_menu (MateConfEditorWindow *window,
			      GtkWidget *menu,
			      GtkWidget *add_bookmark,
			      GtkWidget *edit_bookmarks)
{
	MateConfClient *client;
	guint notify_id;

	g_object_set_data (G_OBJECT (menu), "editor-window", window);

	client = mateconf_client_get_default ();
	
	/* Add a notify function */
	mateconf_client_add_dir (client, "/apps/mateconf-editor/bookmarks",
			      MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
	notify_id = mateconf_client_notify_add (client, "/apps/mateconf-editor/bookmarks",
					     mateconf_bookmarks_key_changed, menu, NULL, NULL);
	g_object_set_data_full (G_OBJECT (menu), "notify-id", GINT_TO_POINTER (notify_id),
				remove_notify_id);


	notify_id = mateconf_client_notify_add (client, "/desktop/mate/interface/menus_have_icons",
					     mateconf_bookmarks_have_icons_notify, menu, NULL, NULL); 
	g_object_set_data_full (G_OBJECT (menu), "notify-id-x", GINT_TO_POINTER (notify_id),
				remove_notify_id);

	mateconf_bookmarks_update_menu (menu);

        {
                gboolean have_icons;
                MateConfValue *value;
                GError *err;

                err = NULL;
                value = mateconf_client_get (client, "/desktop/mate/interface/menus_have_icons", &err);

                if (err != NULL || value == NULL || value->type != MATECONF_VALUE_BOOL)
                        return;

                have_icons = mateconf_value_get_bool (value);
                mateconf_bookmarks_set_have_icons (menu, have_icons);

                mateconf_value_free (value);
        }

	if ( ! mateconf_client_key_is_writable (client, "/apps/mateconf-editor/bookmarks", NULL)) {
		gtk_widget_set_sensitive (add_bookmark, FALSE);
		gtk_widget_set_sensitive (edit_bookmarks, FALSE);
	}

	g_object_unref (client);
}
예제 #22
0
/* Properties dialog
 */
static void
save_macros_to_mateconf (MCData *mc)
{
    MCPrefsDialog *dialog;
    GtkTreeIter    iter;
    MateConfValue    *patterns;
    MateConfValue    *commands;
    GSList        *pattern_list = NULL;
    GSList        *command_list = NULL;
    MateConfClient   *client;

    dialog = &mc->prefs_dialog;

    if (!gtk_tree_model_get_iter_first  (GTK_TREE_MODEL (dialog->macros_store), &iter))
	return;

    patterns = mateconf_value_new (MATECONF_VALUE_LIST);
    mateconf_value_set_list_type (patterns, MATECONF_VALUE_STRING);

    commands = mateconf_value_new (MATECONF_VALUE_LIST);
    mateconf_value_set_list_type (commands, MATECONF_VALUE_STRING);

    do {
	char *pattern = NULL;
	char *command = NULL;

	gtk_tree_model_get (
		GTK_TREE_MODEL (dialog->macros_store), &iter,
		0, &pattern,
		1, &command,
		-1);

	pattern_list = g_slist_prepend (pattern_list,
					mateconf_value_new_from_string (MATECONF_VALUE_STRING, pattern, NULL));
	command_list = g_slist_prepend (command_list,
					mateconf_value_new_from_string (MATECONF_VALUE_STRING, command, NULL));
    } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->macros_store), &iter));

    pattern_list = g_slist_reverse (pattern_list);
    command_list = g_slist_reverse (command_list);

    mateconf_value_set_list_nocopy (patterns, pattern_list); pattern_list = NULL;
    mateconf_value_set_list_nocopy (commands, command_list); command_list = NULL;
    
    client = mateconf_client_get_default ();
    mateconf_client_set (client, "/apps/mini-commander/macro_patterns",
		    patterns, NULL);
    mateconf_client_set (client, "/apps/mini-commander/macro_commands",
		    commands, NULL);

    mateconf_value_free (patterns);
    mateconf_value_free (commands);
}
예제 #23
0
static void
gn_combo_history_init (GnComboHistory *history)
{
	g_return_if_fail (GN_IS_COMBO_HISTORY (history));

	history->priv = g_new0 (GnComboHistoryPrivate, 1);
	history->priv->combo = NULL;
	history->priv->id = NULL;
	history->priv->max_history = 10;
	history->priv->items = NULL;
	history->priv->mateconf_client = mateconf_client_get_default ();
	history->priv->mateconf_notify = 0;
}
예제 #24
0
void
mcharmap_settings_initialize (void)
{
  client = mateconf_client_get_default ();

  if (client == NULL) {
    g_message(_("MateConf could not be initialized."));
    return;
  }

  mateconf_client_add_dir (client, MATECONF_PREFIX,
                        MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
}
static EnumGroup *
enum_group_create (const gchar         *mateconf_key,
		   MateConfEnumStringPair *enums,
		   int                  default_value,
		   GtkWidget           *first_widget,
		   ...)
{
  EnumGroup *group;
  GtkWidget *widget;
  va_list args;

  group = g_new (EnumGroup, 1);

  group->client = mateconf_client_get_default ();
  group->mateconf_key = g_strdup (mateconf_key);
  group->enums = enums;
  group->default_value = default_value;
  group->items = NULL;

  va_start (args, first_widget);

  widget = first_widget;
  while (widget) {
    EnumItem *item;

    item = g_new (EnumItem, 1);
    item->group = group;
    item->widget = GTK_TOGGLE_BUTTON (widget);
    item->value = va_arg (args, int);

    g_signal_connect (item->widget, "toggled",
		      G_CALLBACK (enum_item_toggled), item);

    group->items = g_slist_prepend (group->items, item);

    widget = va_arg (args, GtkWidget *);
  }

  va_end (args);

  enum_group_load (group);

  mateconf_client_notify_add (group->client, mateconf_key,
			   enum_group_changed,
			   group, NULL, NULL);

  return group;
}
static void
calendar_sources_init (CalendarSources *sources)
{
  sources->priv = CALENDAR_SOURCES_GET_PRIVATE (sources);

  sources->priv->appointment_sources.source_type    = E_CAL_SOURCE_TYPE_EVENT;
  sources->priv->appointment_sources.sources        = sources;
  sources->priv->appointment_sources.changed_signal = signals [APPOINTMENT_SOURCES_CHANGED];
  sources->priv->appointment_sources.timeout_id     = 0;

  sources->priv->task_sources.source_type    = E_CAL_SOURCE_TYPE_TODO;
  sources->priv->task_sources.sources        = sources;
  sources->priv->task_sources.changed_signal = signals [TASK_SOURCES_CHANGED];
  sources->priv->task_sources.timeout_id     = 0;

  sources->priv->mateconf_client = mateconf_client_get_default ();
}
void
matecomponent_ui_preferences_add_engine (MateComponentUIEngine *engine)
{
	if (!client)
		client = mateconf_client_get_default ();
	
	if (engine_list == NULL) {
		/* We need to intialize the notifiers */
		mateconf_client_add_dir (client, GLOBAL_INTERFACE_KEY, MATECONF_CLIENT_PRELOAD_RECURSIVE, NULL);
		
		desktop_notify_id = mateconf_client_notify_add (client, GLOBAL_INTERFACE_KEY,
							     keys_changed_fn,
							     NULL, NULL, NULL);
	}

	engine_list = g_slist_prepend (engine_list, engine);
}
예제 #28
0
gboolean
mc_key_writable (MCData *mc, const char *key)
{
	gboolean writable;
	char *fullkey;
	static MateConfClient *client = NULL;
	if (client == NULL)
		client = mateconf_client_get_default ();

	fullkey = mate_panel_applet_mateconf_get_full_key (mc->applet, key);

	writable = mateconf_client_key_is_writable (client, fullkey, NULL);

	g_free (fullkey);

	return writable;
}
gboolean
_mate_mateconf_get_bool (const char *key)
{
	MateConfClient *client;
	gboolean ret;

	mateui_mateconf_lazy_init ();

	client = mateconf_client_get_default ();

	ret = mateconf_client_get_bool (client,
				     key,
                                     NULL);

	g_object_unref (G_OBJECT (client));

	return ret;
}
int main (int argc, char** argv)
{
    MateDACapplet* capplet;

    gchar* start_page = NULL;

    GOptionContext* context;
    GOptionEntry option_entries[] = {
		{
			"show-page",
			'p',
			G_OPTION_FLAG_IN_MAIN,
			G_OPTION_ARG_STRING,
			&start_page,
			/* TRANSLATORS: don't translate the terms in brackets */
			N_("Specify the name of the page to show (internet|multimedia|system|a11y)"),
			N_("page")
		},
		{NULL}
    };

    context = g_option_context_new(_("- MATE Default Applications"));
    g_option_context_add_main_entries (context, option_entries, GETTEXT_PACKAGE);

    capplet_init (context, &argc, &argv);

    capplet = g_new0(MateDACapplet, 1);
    capplet->mateconf = mateconf_client_get_default();
    mateconf_client_add_dir(capplet->mateconf, "/desktop/mate/url-handlers", MATECONF_CLIENT_PRELOAD_RECURSIVE, NULL);
    mateconf_client_add_dir(capplet->mateconf, "/desktop/mate/applications", MATECONF_CLIENT_PRELOAD_RECURSIVE, NULL);

    mate_da_xml_load_list(capplet);

    show_dialog(capplet, start_page);
    g_free(start_page);

    gtk_main();

    g_object_unref(capplet->mateconf);

    mate_da_xml_free(capplet);

    return 0;
}