/** * 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); }
void mcharmap_settings_set_chapters_mode (McharmapChaptersMode mode) { switch (mode) { case MCHARMAP_CHAPTERS_SCRIPT: mateconf_client_set_string (client, MATECONF_PREFIX"/chapters_mode", "script", NULL); break; case MCHARMAP_CHAPTERS_BLOCK: mateconf_client_set_string (client, MATECONF_PREFIX"/chapters_mode", "block", NULL); break; } }
gboolean panel_menu_button_create (PanelToplevel *toplevel, int position, const char *filename, const char *menu_path, gboolean use_menu_path, const char *tooltip) { MateConfClient *client; const char *scheme; const char *key; char *id; client = panel_mateconf_get_client (); id = panel_profile_prepare_object (PANEL_OBJECT_MENU, toplevel, position, FALSE); key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "use_menu_path"); mateconf_client_set_bool (client, key, use_menu_path, NULL); scheme = panel_menu_filename_to_scheme (filename); if (filename && !scheme) { g_warning ("Failed to find menu scheme for %s\n", filename); g_free (id); return FALSE; } if (use_menu_path && menu_path && menu_path [0] && scheme) { char *menu_uri; menu_uri = g_strconcat (scheme, ":", menu_path, NULL); key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "menu_path"); mateconf_client_set_string (client, key, menu_uri, NULL); g_free (menu_uri); } if (tooltip && tooltip [0]) { key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "tooltip"); mateconf_client_set_string (client, key, tooltip, NULL); } panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id); g_free (id); return TRUE; }
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); }
void mate_panel_applet_mateconf_set_string (MatePanelApplet *applet, const gchar *key, const gchar *the_string, GError **opt_error) { MateConfClient *client; gchar *full_key; GError **error = NULL; GError *our_error = NULL; g_return_if_fail (PANEL_IS_APPLET (applet)); if (opt_error) error = opt_error; else error = &our_error; full_key = mate_panel_applet_mateconf_get_full_key (applet, key); client = mate_panel_applet_mateconf_get_client (); mateconf_client_set_string (client, full_key, the_string, error); g_free (full_key); if (!opt_error && our_error) { g_warning (G_STRLOC ": mateconf error : '%s'", our_error->message); g_error_free (our_error); } }
static void web_radiobutton_toggled_cb(GtkWidget* togglebutton, MateDACapplet* capplet) { gint index; MateDAWebItem *item; const gchar *command; GError *error = NULL; index = gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->web_combo_box)); if (index == -1) return; item = (MateDAWebItem *) g_list_nth_data (capplet->web_browsers, index); if (item == NULL) return; if (togglebutton == capplet->new_win_radiobutton) { command = item->win_command; } else if (togglebutton == capplet->new_tab_radiobutton) { command = item->tab_command; } else { command = item->generic.command; } mateconf_client_set_string (capplet->mateconf, DEFAULT_APPS_KEY_HTTP_EXEC, command, &error); gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), command); if (error != NULL) { g_warning (_("Error saving configuration: %s"), error->message); g_error_free (error); } }
void visual_menu_changed (GtkComboBox *combobox, Idol *idol) { GList *list; char *old_name, *name; int i; i = gtk_combo_box_get_active (combobox); list = bacon_video_widget_get_visuals_list (idol->bvw); name = g_list_nth_data (list, i); old_name = mateconf_client_get_string (idol->gc, MATECONF_PREFIX"/visual", NULL); if (old_name == NULL || strcmp (old_name, name) != 0) { mateconf_client_set_string (idol->gc, MATECONF_PREFIX"/visual", name, NULL); if (bacon_video_widget_set_visuals (idol->bvw, name) != FALSE) idol_action_info (_("Changing the visuals effect type will require a restart to take effect."), idol); } g_free (old_name); }
void font_set_cb (GtkFontButton * fb, Idol * idol) { const gchar *font; font = gtk_font_button_get_font_name (fb); mateconf_client_set_string (idol->gc, MATECONF_PREFIX"/subtitle_font", font, NULL); }
void mcharmap_settings_set_font (gchar *fontname) { if (!mcharmap_settings_initialized ()) { return; } mateconf_client_set_string (client, MATECONF_PREFIX"/font", fontname, NULL); }
static void font_radio_toggled (GtkToggleButton *toggle_button, FontPair *pair) { if (!in_change) { MateConfClient *client = mateconf_client_get_default (); mateconf_client_set_string (client, FONT_ANTIALIASING_KEY, mateconf_enum_to_string (antialias_enums, pair->antialiasing), NULL); mateconf_client_set_string (client, FONT_HINTING_KEY, mateconf_enum_to_string (hint_enums, pair->hinting), NULL); /* Restore back to the previous state until we get notification */ font_render_load (client); g_object_unref (client); } }
void panel_compatiblity_migrate_settings_menu_button (MateConfClient *client, const char *id) { const char *key; panel_profile_remove_from_list (PANEL_MATECONF_OBJECTS, id); key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "launcher_location"); mateconf_client_set_string (client, key, "mate-control-center.desktop", NULL); key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "object_type"); mateconf_client_set_string (client, key, "launcher-object", NULL); panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id); }
void encoding_set_cb (GtkComboBox *cb, Idol *idol) { const gchar *encoding; encoding = idol_subtitle_encoding_get_selected (cb); if (encoding) mateconf_client_set_string (idol->gc, MATECONF_PREFIX"/subtitle_encoding", encoding, NULL); }
void mcharmap_settings_set_last_char (gunichar wc) { char str[32]; if (!mcharmap_settings_initialized ()) { return; } g_snprintf (str, sizeof (str), "U+%04X", wc); str[sizeof (str) - 1] = '\0'; mateconf_client_set_string (client, MATECONF_PREFIX"/last_char", str, NULL); }
static void enum_item_toggled (GtkToggleButton *toggle_button, EnumItem *item) { EnumGroup *group = item->group; if (!in_change) { mateconf_client_set_string (group->client, group->mateconf_key, mateconf_enum_to_string (group->enums, item->value), NULL); } /* Restore back to the previous state until we get notification */ enum_group_load (group); }
void entry_activated_callback(GtkWidget* entry, gpointer user_data) { MateConfClient* client; gchar* str; client = MATECONF_CLIENT(user_data); str = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); mateconf_client_set_string(client, "/extra/test/directory/key", str, NULL); g_free(str); }
void panel_action_button_create (PanelToplevel *toplevel, int position, PanelActionButtonType type) { MateConfClient *client; const char *key; char *id; client = panel_mateconf_get_client (); id = panel_profile_prepare_object (PANEL_OBJECT_ACTION, toplevel, position, FALSE); key = panel_mateconf_full_key (PANEL_MATECONF_OBJECTS, id, "action_type"); mateconf_client_set_string (client, key, mateconf_enum_to_string (panel_action_type_map, type), NULL); panel_profile_add_to_list (PANEL_MATECONF_OBJECTS, id); g_free (id); }
/* Commit changes to the MateConf database. */ static gboolean config_entry_commit (GtkWidget *entry, GdkEvent *event, gpointer callback_data) { gchar *text; const gchar *key; MateConfClient *client; client = g_object_get_data (G_OBJECT (entry), "client"); text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); key = g_object_get_data (G_OBJECT (entry), "key"); /* Unset if the string is zero-length, otherwise set */ if (*text != '\0') mateconf_client_set_string (client, key, text, NULL); else mateconf_client_unset (client, key, NULL); g_free (text); return FALSE; }
void mate_panel_applet_save_position (AppletInfo *applet_info, const char *id, gboolean immediate) { PanelMateConfKeyType key_type; MateConfClient *client; PanelWidget *panel_widget; const char *key; const char *toplevel_id; char *old_toplevel_id; gboolean right_stick; gboolean locked; int position; g_return_if_fail (applet_info != NULL); if (!immediate) { if (!queued_position_source) queued_position_source = g_timeout_add_seconds (1, (GSourceFunc) mate_panel_applet_position_save_timeout, NULL); if (!g_slist_find (queued_position_saves, applet_info)) queued_position_saves = g_slist_prepend (queued_position_saves, applet_info); return; } if (!(toplevel_id = mate_panel_applet_get_toplevel_id (applet_info))) return; client = panel_mateconf_get_client (); key_type = applet_info->type == PANEL_OBJECT_APPLET ? PANEL_MATECONF_APPLETS : PANEL_MATECONF_OBJECTS; panel_widget = mate_panel_applet_get_panel_widget (applet_info); /* FIXME: Instead of getting keys, comparing and setting, there should be a dirty flag */ key = panel_mateconf_full_key (key_type, id, "toplevel_id"); old_toplevel_id = mateconf_client_get_string (client, key, NULL); if (old_toplevel_id == NULL || strcmp (old_toplevel_id, toplevel_id) != 0) mateconf_client_set_string (client, key, toplevel_id, NULL); g_free (old_toplevel_id); /* Note: changing some properties of the panel that may not be locked down (e.g. background) can change the state of the "panel_right_stick" and "position" properties of an applet that may in fact be locked down. So check if these are writable before attempting to write them */ right_stick = panel_is_applet_right_stick (applet_info->widget) ? 1 : 0; key = panel_mateconf_full_key ( key_type, id, "panel_right_stick"); if (mateconf_client_key_is_writable (client, key, NULL) && (mateconf_client_get_bool (client, key, NULL) ? 1 : 0) != right_stick) mateconf_client_set_bool (client, key, right_stick, NULL); position = mate_panel_applet_get_position (applet_info); if (right_stick && !panel_widget->packed) position = panel_widget->size - position; key = panel_mateconf_full_key (key_type, id, "position"); if (mateconf_client_key_is_writable (client, key, NULL) && mateconf_client_get_int (client, key, NULL) != position) mateconf_client_set_int (client, key, position, NULL); locked = panel_widget_get_applet_locked (panel_widget, applet_info->widget) ? 1 : 0; key = panel_mateconf_full_key (key_type, id, "locked"); if (mateconf_client_get_bool (client, key, NULL) ? 1 : 0 != locked) mateconf_client_set_bool (client, key, locked, NULL); }
static void theme_message_area_response_cb (GtkWidget *w, gint response_id, AppearanceData *data) { const MateThemeMetaInfo *theme; gchar *tmpfont; gchar *engine_path; theme = theme_get_selected (GTK_ICON_VIEW (appearance_capplet_get_widget (data, "theme_list")), data); if (!theme) return; switch (response_id) { case RESPONSE_APPLY_BG: mateconf_client_set_string (data->client, BACKGROUND_KEY, theme->background_image, NULL); break; case RESPONSE_REVERT_FONT: if (data->revert_application_font != NULL) { mateconf_client_set_string (data->client, APPLICATION_FONT_KEY, data->revert_application_font, NULL); g_free (data->revert_application_font); data->revert_application_font = NULL; } if (data->revert_documents_font != NULL) { mateconf_client_set_string (data->client, DOCUMENTS_FONT_KEY, data->revert_documents_font, NULL); g_free (data->revert_documents_font); data->revert_documents_font = NULL; } if (data->revert_desktop_font != NULL) { mateconf_client_set_string (data->client, DESKTOP_FONT_KEY, data->revert_desktop_font, NULL); g_free (data->revert_desktop_font); data->revert_desktop_font = NULL; } if (data->revert_windowtitle_font != NULL) { mateconf_client_set_string (data->client, WINDOWTITLE_FONT_KEY, data->revert_windowtitle_font, NULL); g_free (data->revert_windowtitle_font); data->revert_windowtitle_font = NULL; } if (data->revert_monospace_font != NULL) { mateconf_client_set_string (data->client, MONOSPACE_FONT_KEY, data->revert_monospace_font, NULL); g_free (data->revert_monospace_font); data->revert_monospace_font = NULL; } break; case RESPONSE_APPLY_FONT: if (theme->application_font) { tmpfont = mateconf_client_get_string (data->client, APPLICATION_FONT_KEY, NULL); if (tmpfont != NULL) { g_free (data->revert_application_font); if (strcmp (theme->application_font, tmpfont) == 0) { g_free (tmpfont); data->revert_application_font = NULL; } else data->revert_application_font = tmpfont; } mateconf_client_set_string (data->client, APPLICATION_FONT_KEY, theme->application_font, NULL); } if (theme->documents_font) { tmpfont = mateconf_client_get_string (data->client, DOCUMENTS_FONT_KEY, NULL); if (tmpfont != NULL) { g_free (data->revert_documents_font); if (strcmp (theme->documents_font, tmpfont) == 0) { g_free (tmpfont); data->revert_documents_font = NULL; } else data->revert_documents_font = tmpfont; } mateconf_client_set_string (data->client, DOCUMENTS_FONT_KEY, theme->documents_font, NULL); } if (theme->desktop_font) { tmpfont = mateconf_client_get_string (data->client, DESKTOP_FONT_KEY, NULL); if (tmpfont != NULL) { g_free (data->revert_desktop_font); if (strcmp (theme->desktop_font, tmpfont) == 0) { g_free (tmpfont); data->revert_desktop_font = NULL; } else data->revert_desktop_font = tmpfont; } mateconf_client_set_string (data->client, DESKTOP_FONT_KEY, theme->desktop_font, NULL); } if (theme->windowtitle_font) { tmpfont = mateconf_client_get_string (data->client, WINDOWTITLE_FONT_KEY, NULL); if (tmpfont != NULL) { g_free (data->revert_windowtitle_font); if (strcmp (theme->windowtitle_font, tmpfont) == 0) { g_free (tmpfont); data->revert_windowtitle_font = NULL; } else data->revert_windowtitle_font = tmpfont; } mateconf_client_set_string (data->client, WINDOWTITLE_FONT_KEY, theme->windowtitle_font, NULL); } if (theme->monospace_font) { tmpfont = mateconf_client_get_string (data->client, MONOSPACE_FONT_KEY, NULL); if (tmpfont != NULL) { g_free (data->revert_monospace_font); if (strcmp (theme->monospace_font, tmpfont) == 0) { g_free (tmpfont); data->revert_monospace_font = NULL; } else data->revert_monospace_font = tmpfont; } mateconf_client_set_string (data->client, MONOSPACE_FONT_KEY, theme->monospace_font, NULL); } break; case RESPONSE_INSTALL_ENGINE: engine_path = gtk_theme_info_missing_engine(theme->gtk_theme_name, FALSE); if (engine_path != NULL) { theme_install_file(GTK_WINDOW(gtk_widget_get_toplevel(data->install_button)), engine_path); g_free (engine_path); } theme_message_area_update(data); break; } }
gchar * panel_compatibility_get_applet_iid (const gchar *id) { MateConfClient *client = panel_mateconf_get_client (); MatePanelAppletInfo *info; const char *key; gchar *applet_iid; gboolean needs_migration; const char *iid; /* * There are two compatibility steps here: * * 1) we need to migrate from bonobo_iid to applet_iid if there's no * value in the applet_iid key. Always. * * 2) we need to try to migrate the iid to a new iid. We can't assume * that the fact that the applet_iid key was used mean anything * since the value there could well be a bonobo iid. * The reason we really have to try to migrate first is this case: * if an applet was added with the bonobo iid but gets ported later * to dbus, then the reference to the bonobo iid will only be valid * as an old reference. * And if migration fails, we just use the iid as it is. */ needs_migration = FALSE; key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "applet_iid"); applet_iid = mateconf_client_get_string (client, key, NULL); if (!applet_iid || !applet_iid[0]) { needs_migration = TRUE; key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "bonobo_iid"); applet_iid = mateconf_client_get_string (client, key, NULL); if (!applet_iid || !applet_iid[0]) return NULL; } info = mate_panel_applets_manager_get_applet_info_from_old_id (applet_iid); if (!info) info = mate_panel_applets_manager_get_applet_info (applet_iid); if (!info) return NULL; iid = mate_panel_applet_info_get_iid (info); /* migrate if the iid in the configuration is different than the real * iid that will get used */ if (!g_str_equal (iid, applet_iid)) needs_migration = TRUE; g_free (applet_iid); if (needs_migration) { key = panel_mateconf_full_key (PANEL_MATECONF_APPLETS, id, "applet_iid"); mateconf_client_set_string (client, key, iid, NULL); } return g_strdup (iid); }