Beispiel #1
0
/* This gets called when the active profile changes */
static void
initialize_profile(const char *name, PurplePrefType type, gconstpointer val, gpointer null)
{
	FinchSoundEvent *event;
	if (purple_prefs_exists(make_pref("")))
		return;

	purple_prefs_add_none(make_pref(""));
	purple_prefs_add_none(make_pref("/enabled"));
	purple_prefs_add_none(make_pref("/file"));

	for (event = sounds; event - sounds < PURPLE_NUM_SOUNDS; event++) {
		char pref[512];
		g_snprintf(pref, sizeof(pref), "/enabled/%s", event->pref);
		purple_prefs_add_bool(make_pref(pref), FALSE);
		g_snprintf(pref, sizeof(pref), "/file/%s", event->pref);
		purple_prefs_add_path(make_pref(pref), "");
	}

	purple_prefs_add_bool(make_pref("/conv_focus"), FALSE);
	purple_prefs_add_bool(make_pref("/mute"), FALSE);
	purple_prefs_add_path(make_pref("/command"), "");
	purple_prefs_add_string(make_pref("/method"), "automatic");
	purple_prefs_add_int(make_pref("/volume"), 50);
}
Beispiel #2
0
void
pidgin_stock_init(void)
{
	PidginIconThemeLoader *loader, *stockloader;
	const gchar *path = NULL;

	if (stock_initted)
		return;

	stock_initted = TRUE;

	/* Setup the status icon theme */
	loader = g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "status-icon", NULL);
	purple_theme_manager_register_type(PURPLE_THEME_LOADER(loader));
	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/status");
	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/status/icon-theme", "");
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", "");

	stockloader = g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "stock-icon", NULL);
	purple_theme_manager_register_type(PURPLE_THEME_LOADER(stockloader));
	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/stock");
	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/stock/icon-theme", "");
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/stock/icon-theme-dir", "");

	/* register custom icon sizes */
	microscopic =  gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC, 11, 11);
	extra_small =  gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL, 16, 16);
	small       =  gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_SMALL, 22, 22);
	medium      =  gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MEDIUM, 32, 32);
	large       =  gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_LARGE, 48, 48);
	huge        =  gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_HUGE, 64, 64);

	pidgin_stock_load_stock_icon_theme(NULL);

	/* Pre-load Status icon theme - this avoids a bug with displaying the correct icon in the tray, theme is destroyed after*/
	if (purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme") &&
	   (path = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir"))) {

		PidginStatusIconTheme *theme = PIDGIN_STATUS_ICON_THEME(purple_theme_loader_build(PURPLE_THEME_LOADER(loader), path));
		pidgin_stock_load_status_icon_theme(theme);
		if (theme)
			g_object_unref(G_OBJECT(theme));

	}
	else
		pidgin_stock_load_status_icon_theme(NULL);

	/* Register the stock items. */
	gtk_stock_add_static(stock_items, G_N_ELEMENTS(stock_items));
}
Beispiel #3
0
static void init_plugin(PurplePlugin *plugin)
{
  UNUSED(plugin);

  purple_prefs_add_none(PLUGIN_PREF);
  purple_prefs_add_path(PLUGIN_PREF_COMMAND, "");
}
Beispiel #4
0
void finch_prefs_init()
{
	purple_prefs_add_none("/finch");

	purple_prefs_add_none("/finch/plugins");
	purple_prefs_add_path_list("/finch/plugins/loaded", NULL);
	purple_prefs_add_path_list("/finch/plugins/seen", NULL);

	purple_prefs_add_none("/finch/conversations");
	purple_prefs_add_bool("/finch/conversations/timestamps", TRUE);
	purple_prefs_add_bool("/finch/conversations/notify_typing", FALSE);

	purple_prefs_add_none("/finch/filelocations");
	purple_prefs_add_path("/finch/filelocations/last_save_folder", "");
	purple_prefs_add_path("/finch/filelocations/last_save_folder", "");
}
Beispiel #5
0
static void
update_profiles(void)
{
	GList *list = finch_sound_get_profiles();
	for (; list; list = g_list_delete_link(list, list)) {
		char pname[512];

		/* got_attention was added in libpurple 2.7.0 */
		g_snprintf(pname, sizeof(pname), FINCH_PREFS_ROOT "/sound/profiles/%s%s",
				(char *)list->data, "/enabled/got_attention");
		purple_prefs_add_bool(pname, FALSE);
		g_snprintf(pname, sizeof(pname), FINCH_PREFS_ROOT "/sound/profiles/%s%s",
				(char *)list->data, "/file/got_attention");
		purple_prefs_add_path(pname, "");

		g_free(list->data);
	}
}
Beispiel #6
0
void
purple_prefs_set_path(const char *name, const char *value)
{
	struct purple_pref *pref = find_pref(name);

	if(pref) {
		if(pref->type != PURPLE_PREF_PATH) {
			purple_debug_error("prefs",
					"purple_prefs_set_path: %s not a path pref\n", name);
			return;
		}

		if (!purple_strequal(pref->value.string, value)) {
			g_free(pref->value.string);
			pref->value.string = g_strdup(value);
			do_callbacks(name, pref);
		}
	} else {
		purple_prefs_add_path(name, value);
	}
}
Beispiel #7
0
static void
pidgin_sound_init(void)
{
	void *gtk_sound_handle = pidgin_sound_get_handle();
	void *blist_handle = purple_blist_get_handle();
	void *conv_handle = purple_conversations_get_handle();
#ifdef USE_GSTREAMER
	GError *error = NULL;
#endif

	purple_signal_connect(purple_connections_get_handle(), "signed-on",
						gtk_sound_handle, PURPLE_CALLBACK(account_signon_cb),
						NULL);

	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound");
	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/enabled");
	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/file");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/login", TRUE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/login", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/logout", TRUE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/logout", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/im_recv", TRUE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/im_recv", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/first_im_recv", FALSE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/first_im_recv", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_im", TRUE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_im", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/join_chat", FALSE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/join_chat", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/left_chat", FALSE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/left_chat", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_chat_msg", FALSE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_chat_msg", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/chat_msg_recv", FALSE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said", FALSE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", "");
	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/theme", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention", TRUE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/sent_attention", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention", TRUE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/got_attention", "");
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE);
	purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE);
	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/command", "");
	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/method", "automatic");
	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/sound/volume", 50);

#ifdef USE_GSTREAMER
	purple_debug_info("sound", "Initializing sound output drivers.\n");
	gst_registry_fork_set_enabled(FALSE);
	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
		purple_notify_error(NULL, _("GStreamer Failure"),
					_("GStreamer failed to initialize."),
					error ? error->message : "", NULL);
		if (error) {
			g_error_free(error);
			error = NULL;
		}
	}
#endif /* USE_GSTREAMER */

	purple_signal_connect(blist_handle, "buddy-signed-on",
						gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
						GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE));
	purple_signal_connect(blist_handle, "buddy-signed-off",
						gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
						GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE));
	purple_signal_connect(conv_handle, "received-im-msg",
						gtk_sound_handle, PURPLE_CALLBACK(im_msg_received_cb),
						GINT_TO_POINTER(PURPLE_SOUND_RECEIVE));
	purple_signal_connect(conv_handle, "sent-im-msg",
						gtk_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb),
						GINT_TO_POINTER(PURPLE_SOUND_SEND));
	purple_signal_connect(conv_handle, "chat-user-joined",
						gtk_sound_handle, PURPLE_CALLBACK(chat_user_join_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN));
	purple_signal_connect(conv_handle, "chat-user-left",
						gtk_sound_handle, PURPLE_CALLBACK(chat_user_left_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE));
	purple_signal_connect(conv_handle, "sent-chat-msg",
						gtk_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY));
	purple_signal_connect(conv_handle, "received-chat-msg",
						gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY));
	purple_signal_connect(conv_handle, "got-attention", gtk_sound_handle,
						PURPLE_CALLBACK(got_attention_cb),
						  GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION));
	/* for the time being, don't handle sent-attention here, since playing a
	 sound would result induplicate sounds. And fixing that would require changing the
	 conversation signal for msg-recv */
}