static void
panel_menu_button_mateconf_notify (MateConfClient     *client,
				guint            cnxn_id,
				MateConfEntry      *entry,
				PanelMenuButton *button)
{
	MateConfValue *value;
	const char *key;

	key = panel_mateconf_basename (mateconf_entry_get_key (entry));

	value = entry->value;

	if (!strcmp (key, "menu_path")) {
		if (value && value->type == MATECONF_VALUE_STRING)
			panel_menu_button_set_menu_path (button,
							 mateconf_value_get_string (value));
	} else if (!strcmp (key, "custom_icon")) {
		if (value && value->type == MATECONF_VALUE_STRING)
			panel_menu_button_set_custom_icon (button,
							   mateconf_value_get_string (value));
	} else if (!strcmp (key, "tooltip")) {
		if (value && value->type == MATECONF_VALUE_STRING)
			panel_menu_button_set_tooltip (button,
						       mateconf_value_get_string (value));
	} else if (!strcmp (key, "use_menu_path")) {
		if (value && value->type == MATECONF_VALUE_BOOL)
			panel_menu_button_set_use_menu_path (button,
							     mateconf_value_get_bool (value));
	} else if (!strcmp (key, "use_custom_icon")) {
		if (value && value->type == MATECONF_VALUE_BOOL)
			panel_menu_button_set_use_custom_icon (button,
							       mateconf_value_get_bool (value));
	}
}
static void
mateconf_notify (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
{
    BastileWidget *swidget;

    if (g_str_equal (PUBLISH_TO_KEY, mateconf_entry_get_key (entry))) {
        swidget = BASTILE_WIDGET (data);
        update_message (swidget);
    }
}
Beispiel #3
0
static gboolean
read_done_item_is_writable( const NAIFactoryProvider *provider, NAObjectItem *item, ReaderData *data, GSList **messages )
{
	GSList *ie;
	gboolean writable;
	MateConfEntry *mateconf_entry;
	const gchar *key;

	/* check for writability of this item
	 * item is writable if and only if all entries are themselves writable
	 */
	writable = TRUE;
	for( ie = data->entries ; ie && writable ; ie = ie->next ){
		mateconf_entry = ( MateConfEntry * ) ie->data;
		key = mateconf_entry_get_key( mateconf_entry );
		writable = is_key_writable( NAGP_MATECONF_PROVIDER( provider ), key );
	}

	g_debug( "nagp_reader_read_done_item: writable=%s", writable ? "True":"False" );
	return( writable );
}
Beispiel #4
0
static void
panel_addto_name_notify (MateConfClient      *client,
			 guint             cnxn_id,
			 MateConfEntry       *entry,
			 PanelAddtoDialog *dialog)
{
	MateConfValue *value;
	const char *key;
	const char *text = NULL;

	key = panel_mateconf_basename (mateconf_entry_get_key (entry));

	if (strcmp (key, "name"))
		return;

	value = mateconf_entry_get_value (entry);

	if (value && value->type == MATECONF_VALUE_STRING)
		text = mateconf_value_get_string (value);

	if (text)
		panel_addto_name_change (dialog, text);
}
static void
keys_changed_fn (MateConfClient *client, guint cnxn_id, MateConfEntry *entry, gpointer user_data)
{
	const char *key_name;

	key_name = mateconf_entry_get_key (entry);
	g_return_if_fail (key_name != NULL);

	/* FIXME: update the values instead */
	if (!strcmp (key_name, GLOBAL_INTERFACE_KEY "/toolbar_detachable"))
		cached_toolbar_detachable = FALSE;
	else if (!strcmp (key_name, GLOBAL_INTERFACE_KEY "/menus_have_icons"))
		cached_menus_have_icons = FALSE;
	else if (!strcmp (key_name, GLOBAL_INTERFACE_KEY "/menus_have_tearoff"))
		cached_menus_have_tearoff = FALSE;
	else if (!strcmp (key_name, GLOBAL_INTERFACE_KEY "/menubar_detachable"))
		cached_menubar_detachable = FALSE;

	if (update_engines_idle_id != 0)
		return;

	update_engines_idle_id = g_idle_add (update_engines_idle_callback, NULL);
}
static
gboolean
mateconf_tree_model_search_iter_foreach (GtkTreeModel *model, GtkTreePath *path,
				      GtkTreeIter *iter, gpointer data)
{
	Node    *node;
	SearchIter *st;
	gchar *found;
	GSList *values, *list;

	st = (SearchIter *) data;

	if (st->searching == NULL) {
		return TRUE;
	}

	if (st->res >= 1) {
		gtk_widget_show (GTK_WIDGET (st->output_window));
	}
	while (gtk_events_pending ())
		gtk_main_iteration ();

	node = iter->user_data;
	found = g_strrstr ((char*) node->path, (char*) st->pattern);

	if (found != NULL) {
		/* We found the pattern in the tree */
		gchar *key = mateconf_tree_model_get_mateconf_path (MATECONF_TREE_MODEL (model), iter);
		gedit_output_window_append_line (st->output_window, key, FALSE);
		g_free (key);
		st->res++;
		return FALSE;
	}

	if (!st->search_keys && !st->search_values) {
		return FALSE;
	}
	values = mateconf_client_all_entries (MATECONF_TREE_MODEL (model)->client, (const char*) node->path , NULL);
	for (list = values; list; list = list->next) {
		const gchar *key;
		MateConfEntry *entry = list->data;
		key = mateconf_entry_get_key (entry);
		/* Search in the key names */
		if (st->search_keys) {
			found = g_strrstr (key, (char*) st->pattern);
			if (found != NULL) {
				/* We found the pattern in the final key name */
				gedit_output_window_append_line (st->output_window, key, FALSE);
				st->res++;
				mateconf_entry_unref (entry);
				/* After finding an entry continue the list to find other matches */
				continue;
			}
		}

		/* Search in the values */
		if (st->search_values) {
			const char *mateconf_string;
			MateConfValue *mateconf_value = mateconf_entry_get_value (entry);

			/* FIXME: We are only looking into strings... should we do in
			 * int's? */
			if (mateconf_value != NULL && mateconf_value->type == MATECONF_VALUE_STRING)
				mateconf_string = mateconf_value_get_string (mateconf_value);
			else {
				mateconf_entry_unref (entry);
				continue;
			}

                	found = g_strrstr (mateconf_string, (char*) st->pattern);
			if (found != NULL) {
				/* We found the pattern in the key value */
				gedit_output_window_append_line (st->output_window, key, FALSE);
				st->res++;
				mateconf_entry_unref (entry);
				continue;
			}
		}
		mateconf_entry_unref (entry);
	}

	return FALSE;
}
static void
recursive_unset_helper (MateConfSources   *sources,
                        const char     *key,
                        const char     *locale,
                        MateConfUnsetFlags flags,
                        GSList        **notifies,
                        GError        **first_error)
{
  GError* err = NULL;
  GSList* subdirs;
  GSList* entries;
  GSList* tmp;
  const char *locales[2] = { NULL, NULL };
  MateConfSources* modified_sources;
  MateConfSources** modifiedp = NULL;

  if (notifies)
    {
      modified_sources = NULL;
      modifiedp = &modified_sources;
    }
  
  err = NULL;
  
  subdirs = mateconf_sources_all_dirs (sources, key, &err);
          
  if (subdirs != NULL)
    {
      tmp = subdirs;

      while (tmp != NULL)
        {
          char *s = tmp->data;
          char *full = mateconf_concat_dir_and_key (key, s);
          
          recursive_unset_helper (sources, full, locale, flags,
                                  notifies, first_error);
          
          g_free (s);
          g_free (full);

          tmp = g_slist_next (tmp);
        }

      g_slist_free (subdirs);
    }
  else
    {
      if (err != NULL)
        {
          mateconf_log (GCL_DEBUG, "Error listing subdirs of '%s': %s\n",
                     key, err->message);
          if (*first_error)
            g_error_free (err);
          else
            *first_error = err;
          err = NULL;
        }
    }

  locales[0] = locale;
  entries = mateconf_sources_all_entries (sources, key,
                                       locale ? locales : NULL,
                                       &err);
          
  if (err != NULL)
    {
      mateconf_log (GCL_DEBUG, "Failure listing entries in '%s': %s\n",
                 key, err->message);
      if (*first_error)
        g_error_free (err);
      else
        *first_error = err;
      err = NULL;
    }

  if (entries != NULL)
    {
      tmp = entries;

      while (tmp != NULL)
        {
          MateConfEntry* entry = tmp->data;
          char *full, *freeme;

	  full = freeme = mateconf_concat_dir_and_key (key,
						    mateconf_entry_get_key (entry));
          
          
          mateconf_sources_unset_value (sources, full, locale, modifiedp, &err);
          if (notifies)
	    {
	      *notifies = prepend_unset_notify (*notifies, modified_sources, full);
	      modified_sources = NULL;
	      freeme = NULL;
	    }

          if (err != NULL)
            {
              mateconf_log (GCL_DEBUG, "Error unsetting '%s': %s\n",
                         full, err->message);

              if (*first_error)
                g_error_free (err);
              else
                *first_error = err;
              err = NULL;
            }

          if (flags & MATECONF_UNSET_INCLUDING_SCHEMA_NAMES)
            {
              mateconf_sources_set_schema (sources,
                                        full, NULL,
                                        &err);
              if (err != NULL)
                {
                  mateconf_log (GCL_DEBUG, "Error unsetting schema on '%s': %s\n",
                             full, err->message);
                  
                  if (*first_error)
                    g_error_free (err);
                  else
                    *first_error = err;
                  err = NULL;
                }
            }
          
          mateconf_entry_free (entry);
          g_free (freeme);
          
          tmp = g_slist_next (tmp);
        }

      g_slist_free (entries);
    }

  mateconf_sources_unset_value (sources, key, locale, modifiedp, &err);
  if (notifies)
    {
      *notifies = prepend_unset_notify (*notifies,
					modified_sources,
					g_strdup (key));
      modified_sources = NULL;
    }
  
  if (err != NULL)
    {
      mateconf_log (GCL_DEBUG, "Error unsetting '%s': %s\n",
                 key, err->message);

      if (*first_error)
        g_error_free (err);
      else
        *first_error = err;
      err = NULL;
    }
}