Пример #1
0
void
pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme)
{
	GtkIconFactory *icon_factory;
	gint i;
	GtkIconSet *normal;
	GtkIconSet *translucent = NULL;
	GtkWidget *win;

	if (theme != NULL) {
		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme",
		                        purple_theme_get_name(PURPLE_THEME(theme)));
		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir",
		                      purple_theme_get_dir(PURPLE_THEME(theme)));
	}
	else {
		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme", "");
		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", "");
	}

	icon_factory = gtk_icon_factory_new();

	gtk_icon_factory_add_default(icon_factory);

	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_realize(win);

	for (i = 0; i < G_N_ELEMENTS(sized_status_icons); i++)
	{
		normal = gtk_icon_set_new();
		if (sized_status_icons[i].translucent_name)
			translucent = gtk_icon_set_new();

#define ADD_SIZED_ICON(name, size) \
		if (sized_status_icons[i].name) { \
			add_sized_icon(normal, name, PIDGIN_ICON_THEME(theme), size, sized_status_icons[i], FALSE); \
			if (sized_status_icons[i].translucent_name) \
				add_sized_icon(translucent, name, PIDGIN_ICON_THEME(theme), size, sized_status_icons[i], TRUE); \
		}
		ADD_SIZED_ICON(microscopic, "11");
		ADD_SIZED_ICON(extra_small, "16");
		ADD_SIZED_ICON(small, "22");
		ADD_SIZED_ICON(medium, "32");
		ADD_SIZED_ICON(large, "48");
		ADD_SIZED_ICON(huge, "64");
#undef ADD_SIZED_ICON

		gtk_icon_factory_add(icon_factory, sized_status_icons[i].name, normal);
		gtk_icon_set_unref(normal);

		if (sized_status_icons[i].translucent_name) {
			gtk_icon_factory_add(icon_factory, sized_status_icons[i].translucent_name, translucent);
			gtk_icon_set_unref(translucent);
		}
	}

	gtk_widget_destroy(win);
	g_object_unref(G_OBJECT(icon_factory));
	reload_settings();
}
Пример #2
0
static
void cb_filter_mask_changed(GtkWidget *widget, gpointer data)
{
	const char *text = gtk_entry_get_text(GTK_ENTRY(widget));
	if (strlen(text) == 1)
		purple_prefs_set_string(PREF_MASK, gtk_entry_get_text(GTK_ENTRY(widget)));
}
Пример #3
0
void ggp_servconn_add_server(const gchar *server)
{
	GList *old_entry;
	gchar *joined;

	old_entry = g_list_find_custom(global_data.server_history, server,
		(GCompareFunc)g_strcmp0);
	if (old_entry) {
		g_free(old_entry->data);
		global_data.server_history = g_list_delete_link(
			global_data.server_history, old_entry);
	}

	global_data.server_history = g_list_prepend(global_data.server_history,
		g_strdup(server));
	global_data.server_history = ggp_list_truncate(
		global_data.server_history, GGP_SERVCONN_HISTORY_MAXLEN,
		g_free);

	joined = ggp_strjoin_list(";", global_data.server_history);
	purple_prefs_set_string(GGP_SERVCONN_HISTORY_PREF, joined);
	g_free(joined);
	purple_account_option_string_set_hints(global_data.server_option,
		ggp_servconn_get_servers());
}
Пример #4
0
static void cb_apply_button(GtkWidget *widget, gpointer data)
{
  GtkTreeModel *model;
  GtkTreeIter iter;
  GtkTreeSelection *sel;
  struct mood_dialog *s_diag = (struct mood_dialog *)data;

  sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(s_diag->list_view));
  if(gtk_tree_selection_get_selected(sel, &model, &iter)) {
    const gchar *mood;
    gchar *name;

    gtk_tree_model_get(model, &iter, MOOD_COLUMN, &name, -1);
    mood = g_hash_table_lookup(s_diag->global_moods, name);

    if(mood) { /* mood found */
      gchar *path;

      destroy_mood_dialog(s_diag); /* destroy dialog first */

      set_status_with_mood_all(mood);
      purple_prefs_set_string(PREF "/mood", mood);
      path = get_mood_icon_path(mood);
      set_widget_mood(path);
      g_free(path);

      purple_debug_info(NAME, "mood changed to \"%s\" by user\n", mood);
    } else
      purple_debug_info(NAME, "selected mood \"%s\" doesn't exists\n", name);
    g_free(name);
  } else
    purple_debug_info(NAME, "no row selected\n");
}
Пример #5
0
static gboolean logstat_format (GtkWidget *widget, GdkEventFocus *event,
  gpointer data)
{
  purple_prefs_set_string (
    "/plugins/gtk/autoprofile/components/logstat/format",
    gtk_entry_get_text (GTK_ENTRY (widget)));
  return FALSE;
}
Пример #6
0
/* Update string arguments */
static gboolean update_behavior_string (GtkWidget *widget, GdkEventFocus *evt,
  gpointer data)
{
  ap_debug ("preferences", "behavior string preference modified");

  if (!strcmp (data, "text_trigger")) {
    purple_prefs_set_string ("/plugins/gtk/autoprofile/autorespond/trigger",
      gtk_entry_get_text (GTK_ENTRY (widget)));
  } else if (!strcmp (data, "text_respond")) {
    purple_prefs_set_string ("/plugins/gtk/autoprofile/autorespond/text",
      gtk_entry_get_text (GTK_ENTRY (widget)));
  } else {
    ap_debug_error ("preferences", "invalid data argument to string update");
  }

  return FALSE;
}
void cb_squeezecenter_changed(GtkWidget *entry, gpointer data)
{
	const char *pref = (const char*) data;
	purple_prefs_set_string(pref, gtk_entry_get_text(GTK_ENTRY(entry)));

	if (strcmp(PREF_SQUEEZECENTER_SERVER,pref) == 0) {
		squeezecenter_disconnect(&squeezecenter);
	}
}
static void reset_sort_method() {
	if(purple_utf8_strcasecmp(
		purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type"),
		"ext_blist_sort"
	) == 0) {
		if(purple_utf8_strcasecmp(
			purple_prefs_get_string(PLUGIN_PREFS_PREFIX "/old_sort_method"),
			""
		) != 0) {
			purple_prefs_set_string(
				PIDGIN_PREFS_ROOT "/blist/sort_type",
				purple_prefs_get_string(PLUGIN_PREFS_PREFIX "/old_sort_method")
			);
		} else {
			purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/sort_type", "none");
		}
	}
}
Пример #9
0
static void set_preferred_voice(const char *voice) {

  if (voice) {
    purple_prefs_set_string("/plugins/gtk/festival/speaker/voice", voice);
    if (festival_pf) {
      fprintf(festival_pf,"(voice_%s)\n", voice);
      fflush(festival_pf);
    }
  }
}
Пример #10
0
// Set Functions
static void set_stretch_duration(float duration) {

  if(festival_pf) {
    char sd[8];
    sprintf(sd,"%2.1f",duration);
    purple_prefs_set_string("/plugins/gtk/festival/speaker/duration", sd);
    fprintf(festival_pf,"(Parameter.set 'Duration_Stretch %s)\n", sd);
    fflush(festival_pf);
  }
}
Пример #11
0
void
action_off_status(PurplePluginAction *action)
{
	char buf[STRLEN];
	strncpy(buf, purple_prefs_get_string("/plugins/core/musictracker/string_off"), STRLEN);
	if (input_dialog("Status to Set When Player is OFF:", buf, STRLEN)) {
		purple_prefs_set_string("/plugins/core/musictracker/string_off",
				buf);
	}
}
Пример #12
0
xmlnode * _h_elim_set_prefs ( const char *name ,
                              const char *id   ,
                              SEXP_VALUE *args ,
                              gpointer    data )
{
    ASSERT_ALISTP( args, id, name );
    elim_ping();
    xmlnode    *rval  = xnode_new( "alist" );
    xmlnode    *set   = xnode_new( "alist" );
    GHashTable *prefs = ALIST_VAL_ALIST( args, "prefs" );
    SEXP_VALUE *PREFS = ALIST_VAL      ( args, "prefs" );

    AL_NODE( rval, "prefs", set );

    fprintf( stderr, "hash: %p; sexp: %p\n", prefs, PREFS );

    if( prefs )
    {
        GList *key  = NULL;
        GList *keys = g_hash_table_get_keys( prefs );

        fprintf( stderr, "keys: %p", keys );

        for( key = keys; key; key = key->next )
        {
            gboolean        done = TRUE;
            const char     *pref = key->data;
            PurplePrefType  type = purple_prefs_get_type( pref );
            switch( type )
            {
            case PURPLE_PREF_BOOLEAN:
                purple_prefs_set_bool  ( pref, ALIST_VAL_BOOL( PREFS, pref ) );
                break;
            case PURPLE_PREF_INT:
                purple_prefs_set_int   ( pref, ALIST_VAL_INT ( PREFS, pref ) );
                break;
            case PURPLE_PREF_STRING:
                purple_prefs_set_string( pref, ALIST_VAL_STR ( PREFS, pref ) );
                break;
            case PURPLE_PREF_PATH:
                purple_prefs_set_path  ( pref, ALIST_VAL_STR ( PREFS, pref ) );
                break;
            default:
                done = FALSE;
            }

            AL_BOOL( set, pref, done );
        }

        g_list_free( keys );
    }

    sexp_val_free( args );
    return response_value( 0, id, name, rval );
}
Пример #13
0
void finch_prefs_update_old()
{
	const char *str = NULL;

	purple_prefs_rename("/gaim/gnt", "/finch");
	purple_prefs_rename("/purple/gnt", "/finch");

	if ((str = purple_prefs_get_string("/purple/away/idle_reporting")) &&
			strcmp(str, "gaim") == 0)
		purple_prefs_set_string("/purple/away/idle_reporting", "purple");
}
Пример #14
0
void finch_request_save_in_prefs(gpointer null, PurpleRequestFields *allfields)
{
	GList *list;
	for (list = purple_request_fields_get_groups(allfields); list; list = list->next) {
		PurpleRequestFieldGroup *group = list->data;
		GList *fields = purple_request_field_group_get_fields(group);
		
		for (; fields ; fields = fields->next) {
			PurpleRequestField *field = fields->data;
			PurpleRequestFieldType type = purple_request_field_get_type(field);
			PurplePrefType pt;
			gpointer val = NULL;
			const char *id = purple_request_field_get_id(field);

			switch (type) {
				case PURPLE_REQUEST_FIELD_LIST:
					val = purple_request_field_list_get_selected(field)->data;
					break;
				case PURPLE_REQUEST_FIELD_BOOLEAN:
					val = GINT_TO_POINTER(purple_request_field_bool_get_value(field));
					break;
				case PURPLE_REQUEST_FIELD_INTEGER:
					val = GINT_TO_POINTER(purple_request_field_int_get_value(field));
					break;
				case PURPLE_REQUEST_FIELD_STRING:
					val = (gpointer)purple_request_field_string_get_value(field);
					break;
				default:
					break;
			}

			pt = purple_prefs_get_type(id);
			switch (pt) {
				case PURPLE_PREF_INT:
				{
					long int tmp = GPOINTER_TO_INT(val);
					if (type == PURPLE_REQUEST_FIELD_LIST) /* Lists always return string */
						sscanf(val, "%ld", &tmp);
					purple_prefs_set_int(id, (gint)tmp);
					break;
				}
				case PURPLE_PREF_BOOLEAN:
					purple_prefs_set_bool(id, GPOINTER_TO_INT(val));
					break;
				case PURPLE_PREF_STRING:
					purple_prefs_set_string(id, val);
					break;
				default:
					break;
			}
		}
	}
}
Пример #15
0
static gboolean
options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data)
{
	if (data == NULL)
		return FALSE;

	if (!strcmp(data, "method_string")) {
		purple_prefs_set_string("/plugins/gtk/X11/notify/title_string",
		                      gtk_entry_get_text(GTK_ENTRY(widget)));
	}

	apply_method();

	return FALSE;
}
Пример #16
0
static void
purple_keyring_set_inuse_drop_cb(gpointer _tracker)
{
    PurpleKeyringChangeTracker *tracker = _tracker;

    g_return_if_fail(tracker != NULL);

    if (tracker->succeeded) {
        purple_keyring_close(tracker->old_kr);

        purple_debug_info("keyring", "Successfully changed keyring.\n");

        purple_keyring_inuse = tracker->new_kr;
        current_change_tracker = NULL;

        if (tracker->cb != NULL)
            tracker->cb(NULL, tracker->cb_data);
        purple_keyring_change_tracker_free(tracker);
        return;
    }

    purple_debug_error("keyring", "Failed to change keyring, aborting.\n");

    purple_keyring_close(tracker->new_kr);

    purple_keyring_pref_disconnect();
    purple_prefs_set_string("/purple/keyring/active",
                            purple_keyring_get_id(tracker->old_kr));
    purple_keyring_pref_connect();

    current_change_tracker = NULL;

    if (tracker->error == NULL) {
        tracker->error = g_error_new(PURPLE_KEYRING_ERROR,
                                     PURPLE_KEYRING_ERROR_UNKNOWN,
                                     _("An unknown error has occured."));
    }

    if (tracker->cb != NULL)
        tracker->cb(tracker->error, tracker->cb_data);

    purple_keyring_change_tracker_free(tracker);
}
Пример #17
0
static void
method_toggle_cb(GtkWidget *widget, gpointer data)
{
	gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
	gchar pref[256];

	g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s",
	           (char *)data);

	purple_prefs_set_bool(pref, on);

	if (!strcmp(data, "method_string")) {
		GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry");
		gtk_widget_set_sensitive(entry, on);

		purple_prefs_set_string("/plugins/gtk/X11/notify/title_string",
		                      gtk_entry_get_text(GTK_ENTRY(entry)));
	}

	apply_method();
}
Пример #18
0
static
void cb_custom_edited(GtkCellRendererText *renderer, char *path, char *str, gpointer data)
{
	GtkTreeIter iter;
	GtkTreeModel *model = (GtkTreeModel*) data;
	if (gtk_tree_model_get_iter_from_string(model, &iter, path)) {
                PurpleAccount *account;
                GValue value;
                memset(&value, 0, sizeof(value));
                gtk_tree_model_get_value(model, &iter, 5, &value);
                assert(G_VALUE_HOLDS_POINTER(&value));
                account = g_value_get_pointer(&value);
                g_value_unset(&value);

		char pref[STRLEN];
		build_pref(pref, PREF_CUSTOM_FORMAT, purple_account_get_username(account), purple_account_get_protocol_name(account));

		gtk_list_store_set(GTK_LIST_STORE(model), &iter, 2, str, -1);
		purple_prefs_set_string(pref, str);
	}
}
Пример #19
0
static void
save_cb(GntWidget *button, gpointer win)
{
	GList * itr;

	purple_prefs_set_string(make_pref("/method"), gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->method)));
	purple_prefs_set_path(make_pref("/command"), gnt_entry_get_text(GNT_ENTRY(pref_dialog->command)));
	purple_prefs_set_bool(make_pref("/conv_focus"), gnt_check_box_get_checked(GNT_CHECK_BOX(pref_dialog->conv_focus)));
	purple_prefs_set_int("/purple/sound/while_status", GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(pref_dialog->while_status))));

	for (itr = gnt_tree_get_rows(GNT_TREE(pref_dialog->events)); itr; itr = itr->next) {
		FinchSoundEvent * event = &sounds[GPOINTER_TO_INT(itr->data)];
		char * filepref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s", finch_sound_get_active_profile(), event->pref);
		char * boolpref = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s", finch_sound_get_active_profile(), event->pref);
		purple_prefs_set_bool(boolpref, gnt_tree_get_choice(GNT_TREE(pref_dialog->events), itr->data));
		purple_prefs_set_path(filepref, event->file ? event->file : "");
		g_free(filepref);
		g_free(boolpref);
	}
	gnt_widget_destroy(GNT_WIDGET(win));
}
Пример #20
0
void pidgin_themes_remove_smiley_theme(const char *file)
{
	char *theme_dir = NULL, *last_slash = NULL;
	g_return_if_fail(NULL != file);

	if (!g_file_test(file, G_FILE_TEST_EXISTS)) return;
	if ((theme_dir = g_strdup(file)) == NULL) return ;

	if ((last_slash = g_strrstr(theme_dir, G_DIR_SEPARATOR_S)) != NULL) {
		GSList *iter = NULL;
		struct smiley_theme *theme = NULL, *new_theme = NULL;

		*last_slash = 0;

		/* Delete files on disk */
		pidgin_themes_remove_theme_dir(theme_dir);

		/* Find theme in themes list and remove it */
		for (iter = smiley_themes ; iter ; iter = iter->next) {
			theme = ((struct smiley_theme *)(iter->data));
			if (!strcmp(theme->path, file))
				break ;
		}
		if (iter) {
			if (theme == current_smiley_theme) {
				new_theme = ((struct smiley_theme *)(NULL == iter->next ? (smiley_themes == iter ? NULL : smiley_themes->data) : iter->next->data));
				if (new_theme)
					purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme->name);
				else
					current_smiley_theme = NULL;
			}
			smiley_themes = g_slist_delete_link(smiley_themes, iter);

			/* Destroy theme structure */
			pidgin_themes_destroy_smiley_theme(theme);
		}
	}

	g_free(theme_dir);
}
Пример #21
0
static void
purplerc_font_response(GtkDialog *font_dialog, gint response, gpointer data)
{
	const gchar *prefpath;
	gint subscript = GPOINTER_TO_INT(data);

	if (response == GTK_RESPONSE_OK) {
		gchar *fontname = NULL;

		if (subscript == -1) {
			prefpath = "/plugins/gtk/purplerc/gtk-font-name";
		} else {
			prefpath = font_prefs[subscript];
		}

		fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog));

		purple_prefs_set_string(prefpath, fontname);
		g_free(fontname);
	}
	gtk_widget_destroy(GTK_WIDGET(font_dialog));
}
Пример #22
0
static void
purplerc_color_response(GtkDialog *color_dialog, gint response, gpointer data)
{
	gint subscript = GPOINTER_TO_INT(data);

	if (response == GTK_RESPONSE_OK) {
		GdkColor color;
		gchar colorstr[8];
#if GTK_CHECK_VERSION(2,14,0)
		GtkWidget *colorsel =
			gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog));
#else
		GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel;
#endif

		gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color);

		g_snprintf(colorstr, sizeof(colorstr), "#%02X%02X%02X",
		           color.red/256, color.green/256, color.blue/256);

		purple_prefs_set_string(color_prefs[subscript], colorstr);
	}
	gtk_widget_destroy(GTK_WIDGET(color_dialog));
}
Пример #23
0
static void
get_plugin_frame(GtkWidget *parent, GtkSizeGroup *sg,
		const gchar *name, const gchar *plugin_label,
		const gchar **plugin_strs, const gchar *plugin_pref,
		const gchar *device_label, const gchar *device_pref)
{
	GtkWidget *vbox, *widget;
	GList *plugins, *devices;

	vbox = pidgin_make_frame(parent, name);

	/* Setup plugin preference */
	plugins = get_element_plugins(plugin_strs);
	widget = pidgin_prefs_dropdown_from_list(vbox, plugin_label,
			PURPLE_PREF_STRING, plugin_pref, plugins);
	g_list_free(plugins);
	gtk_size_group_add_widget(sg, widget);
	gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);

	/* Setup device preference */
	devices = get_element_devices(purple_prefs_get_string(plugin_pref));
	if (g_list_find_custom(devices, purple_prefs_get_string(device_pref),
			(GCompareFunc) strcmp) == NULL)
		purple_prefs_set_string(device_pref, g_list_next(devices)->data);
	widget = pidgin_prefs_dropdown_from_list(vbox, device_label,
			PURPLE_PREF_STRING, device_pref, devices);
	g_list_free(devices);
	gtk_widget_set_name(widget, plugin_pref);
	gtk_size_group_add_widget(sg, widget);
	gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);

	purple_prefs_connect_callback(vbox, plugin_pref,
			device_changed_cb, sg);
	g_signal_connect_swapped(vbox, "destroy",
			G_CALLBACK(purple_prefs_disconnect_by_handle), vbox);
}
Пример #24
0
void cb_xmms_sep_changed(GtkEditable *editable, gpointer data)
{
	const char *text = gtk_entry_get_text(GTK_ENTRY(editable));
	if (strlen(text) == 1)
		purple_prefs_set_string(PREF_XMMS_SEP, text);
}
Пример #25
0
void
pidgin_stock_load_stock_icon_theme(PidginStockIconTheme *theme)
{
	GtkIconFactory *icon_factory;
	gint i;
	GtkWidget *win;

	if (theme != NULL) {
		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/stock/icon-theme",
		                        purple_theme_get_name(PURPLE_THEME(theme)));
		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/stock/icon-theme-dir",
		                      purple_theme_get_dir(PURPLE_THEME(theme)));
	}
	else {
		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/stock/icon-theme", "");
		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/stock/icon-theme-dir", "");
	}

	icon_factory = gtk_icon_factory_new();

	gtk_icon_factory_add_default(icon_factory);

	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_realize(win);

	/* All non-sized icons */
	for (i = 0; i < G_N_ELEMENTS(stock_icons); i++) {
		GtkIconSource *source;
		GtkIconSet *iconset;
		gchar *filename;

		if (stock_icons[i].dir == NULL) {
			/* GTK+ Stock icon */
			iconset = gtk_style_lookup_icon_set(gtk_widget_get_style(win),
					stock_icons[i].filename);
		} else {
			filename = find_file(stock_icons[i].dir, stock_icons[i].filename);

			if (filename == NULL)
				continue;

			source = gtk_icon_source_new();
			gtk_icon_source_set_filename(source, filename);
			gtk_icon_source_set_direction_wildcarded(source, TRUE);
			gtk_icon_source_set_size_wildcarded(source, TRUE);
			gtk_icon_source_set_state_wildcarded(source, TRUE);

			iconset = gtk_icon_set_new();
			gtk_icon_set_add_source(iconset, source);

			gtk_icon_source_free(source);
			g_free(filename);
		}

		gtk_icon_factory_add(icon_factory, stock_icons[i].name, iconset);

		gtk_icon_set_unref(iconset);
	}

	/* All non-status sized icons */
	for (i = 0; i < G_N_ELEMENTS(sized_stock_icons); i++)
	{
		GtkIconSet *iconset = gtk_icon_set_new();

#define ADD_SIZED_ICON(name, size) \
		if (sized_stock_icons[i].name) \
			add_sized_icon(iconset, name, PIDGIN_ICON_THEME(theme), size, sized_stock_icons[i], FALSE);
		ADD_SIZED_ICON(microscopic, "11");
		ADD_SIZED_ICON(extra_small, "16");
		ADD_SIZED_ICON(small, "22");
		ADD_SIZED_ICON(medium, "32");
		ADD_SIZED_ICON(large, "48");
		ADD_SIZED_ICON(huge, "64");
#undef ADD_SIZED_ICON

		gtk_icon_factory_add(icon_factory, sized_stock_icons[i].name, iconset);
		gtk_icon_set_unref(iconset);
	}

	gtk_widget_destroy(win);
	g_object_unref(G_OBJECT(icon_factory));
	reload_settings();
}
Пример #26
0
static void
device_changed_cb(const gchar *name, PurplePrefType type,
		gconstpointer value, gpointer data)
{
	GtkSizeGroup *sg = data;
	GtkWidget *parent, *widget;
	GSList *widgets;
	GList *devices;
	GValue gvalue;
	gint position;
	gchar *label, *pref;

	widgets = gtk_size_group_get_widgets(GTK_SIZE_GROUP(sg));
	for (; widgets; widgets = g_slist_next(widgets)) {
		const gchar *widget_name =
				gtk_widget_get_name(GTK_WIDGET(widgets->data));
		if (!strcmp(widget_name, name)) {
			gchar *temp_str;
			gchar delimiters[3] = {0, 0, 0};
			const gchar *text;
			gint keyval, pos;

			widget = widgets->data;
			/* Get label with _ from the GtkLabel */
			text = gtk_label_get_text(GTK_LABEL(widget));
			keyval = gtk_label_get_mnemonic_keyval(GTK_LABEL(widget));
			delimiters[0] = g_ascii_tolower(keyval);
			delimiters[1] = g_ascii_toupper(keyval);
			pos = strcspn(text, delimiters);
			if (pos != -1) {
				temp_str = g_strndup(text, pos);
				label = g_strconcat(temp_str, "_",
						text + pos, NULL);
				g_free(temp_str);
			} else {
				label = g_strdup(text);
			}
			break;
		}
	}

	if (widgets == NULL)
		return;

	parent = gtk_widget_get_parent(widget);
	widget = parent;
	parent = gtk_widget_get_parent(GTK_WIDGET(widget));
	gvalue.g_type = 0;
	g_value_init(&gvalue, G_TYPE_INT);
	gtk_container_child_get_property(GTK_CONTAINER(parent),
			GTK_WIDGET(widget), "position", &gvalue);
	position = g_value_get_int(&gvalue);
	g_value_unset(&gvalue);
	gtk_widget_destroy(widget);

	pref = g_strdup(name);
	strcpy(pref + strlen(pref) - strlen("plugin"), "device");
	devices = get_element_devices(value);
	if (g_list_find_custom(devices, purple_prefs_get_string(pref),
			(GCompareFunc)strcmp) == NULL)
		purple_prefs_set_string(pref, g_list_next(devices)->data);
	widget = pidgin_prefs_dropdown_from_list(parent,
			label, PURPLE_PREF_STRING,
			pref, devices);
	g_list_free(devices);
	g_signal_connect_swapped(widget, "destroy",
			G_CALLBACK(g_free), pref);
	g_free(label);
	gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);
	gtk_widget_set_name(widget, name);
	gtk_size_group_add_widget(sg, widget);
	gtk_box_reorder_child(GTK_BOX(parent),
			gtk_widget_get_parent(GTK_WIDGET(widget)), position);
}
Пример #27
0
static void set_editor_path (GtkWidget *button, GtkWidget *text_field)
{
	const char * path = gtk_entry_get_text((GtkEntry*)text_field);
	purple_prefs_set_string("/plugins/gtk/musicmessaging/editor_path", path);
	
}
Пример #28
0
/* This will also create it if it doesn't exist */
void
finch_sound_set_active_profile(const char *name)
{
	purple_prefs_set_string(FINCH_PREFS_ROOT "/sound/actprofile", name);
}
Пример #29
0
void IM::setPassword(const string& password)
{
	purple_prefs_set_string("/minbif/password", password.c_str());
}
Пример #30
0
static void
ggzpurple_entry_change_cb(GtkObject *obj, gchar *pref)
{
	purple_prefs_set_string(pref,gtk_entry_get_text(GTK_ENTRY(obj)));
}