本文整理汇总了C++中purple_prefs_get_int函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_prefs_get_int函数的具体用法?C++ purple_prefs_get_int怎么用?C++ purple_prefs_get_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_prefs_get_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extended_buddy_menu_cb
static void extended_buddy_menu_cb(PurpleBlistNode *node, GList **menu) {
PurpleMenuAction *action = NULL;
GList *submenu = NULL;
if(
!PURPLE_BLIST_NODE_IS_CONTACT(node) &&
!PURPLE_BLIST_NODE_IS_BUDDY(node) &&
!PURPLE_BLIST_NODE_IS_CHAT(node)
) {
return;
}
if(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE) {
return;
}
if(
purple_prefs_get_int(PLUGIN_PREFS_PREFIX "/sort1") != SORT_METHOD_PRIORITY &&
purple_prefs_get_int(PLUGIN_PREFS_PREFIX "/sort2") != SORT_METHOD_PRIORITY &&
purple_prefs_get_int(PLUGIN_PREFS_PREFIX "/sort3") != SORT_METHOD_PRIORITY
) {
return;
}
submenu = menu_append(submenu, node, PRIORITY_VERY_HIGH, _("Very High"));
submenu = menu_append(submenu, node, PRIORITY_HIGH, _("High"));
submenu = menu_append(submenu, node, PRIORITY_NORMAL, _("Normal"));
submenu = menu_append(submenu, node, PRIORITY_LOW, _("Low"));
submenu = menu_append(submenu, node, PRIORITY_VERY_LOW, _("Very Low"));
action = purple_menu_action_new(_("Set Priority"), NULL, NULL, submenu);
*menu = g_list_append(*menu, action);
}
示例2: should_hide_notice
static gboolean should_hide_notice(PurpleConversation *conv, const char *name,
GHashTable *users)
{
PurpleConvChat *chat;
int threshold;
struct joinpart_key key;
time_t *last_said;
g_return_val_if_fail(conv != NULL, FALSE);
g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE);
/* If the room is small, don't bother. */
chat = PURPLE_CONV_CHAT(conv);
threshold = purple_prefs_get_int(THRESHOLD_PREF);
if (g_list_length(purple_conv_chat_get_users(chat)) < threshold)
return FALSE;
if (!purple_prefs_get_bool(HIDE_BUDDIES_PREF) &&
purple_find_buddy(purple_conversation_get_account(conv), name))
return FALSE;
/* Only show the notice if the user has spoken recently. */
key.conv = conv;
key.user = (gchar *)name;
last_said = g_hash_table_lookup(users, &key);
if (last_said != NULL)
{
int delay = purple_prefs_get_int(DELAY_PREF);
if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL))
return FALSE;
}
return TRUE;
}
示例3: split_and_send
/* create message queue and prepare timer callbacks */
static void
split_and_send(message_to_conv *msg_to_conv, const char **message) {
gint message_delay_ms;
g_return_if_fail( msg_to_conv != NULL );
g_return_if_fail( message != NULL );
g_return_if_fail( *message != NULL );
/* read and validate preferences */
current_split_size = purple_prefs_get_int("/plugins/core/splitter/split_size");
if( current_split_size > MAX_SPLIT_SIZE ) current_split_size = MAX_SPLIT_SIZE;
if( current_split_size < MIN_SPLIT_SIZE ) current_split_size = MIN_SPLIT_SIZE;
message_delay_ms = purple_prefs_get_int("/plugins/core/splitter/delay_ms");
if( message_delay_ms > MAX_DELAY_MS ) message_delay_ms = MAX_DELAY_MS;
if( message_delay_ms < MIN_DELAY_MS ) message_delay_ms = MIN_DELAY_MS;
/* prepare message queue */
msg_to_conv->messages = create_message_queue(*message);
g_return_if_fail( msg_to_conv->messages != NULL );
/* initialize message send timer */
purple_timeout_add( (g_queue_get_length(msg_to_conv->messages) > 1) ? message_delay_ms : 0,
(GSourceFunc)send_message_timer_cb,
msg_to_conv);
/* free the original message and ensure it does not get sent */
g_free((char*)*message);
*message = NULL;
}
示例4: blist_create_cb
static void blist_create_cb(PurpleBuddyList *purple_blist, void *data) {
purple_debug_info(WINPREFS_PLUGIN_ID, "buddy list created\n");
blist = PIDGIN_BLIST(purple_blist)->window;
if(purple_prefs_get_bool(PREF_DBLIST_DOCKABLE)) {
blist_set_dockable(TRUE);
if(purple_prefs_get_bool(PREF_DBLIST_DOCKED)) {
blist_ab->undocked_height = purple_prefs_get_int(PREF_DBLIST_HEIGHT);
if(!(gdk_window_get_state(gtk_widget_get_window(blist))
& GDK_WINDOW_STATE_WITHDRAWN)) {
gtk_appbar_dock(blist_ab,
purple_prefs_get_int(PREF_DBLIST_SIDE));
if(purple_prefs_get_int(PREF_BLIST_ON_TOP)
== BLIST_TOP_DOCKED)
blist_set_ontop(TRUE);
} else {
g_idle_add(listen_for_blist_visible_cb, NULL);
}
}
}
if(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
blist_set_ontop(TRUE);
}
示例5: plugin_load
static gboolean
plugin_load(PurplePlugin *plugin, GError **error)
{
GList *convs = purple_conversations_get_all();
PurpleSavedStatus *saved_status;
void *conv_handle = purple_conversations_get_handle();
void *gtk_conv_handle = pidgin_conversations_get_handle();
void *savedstat_handle = purple_savedstatuses_get_handle();
purple_prefs_add_none("/plugins/gtk");
purple_prefs_add_none("/plugins/gtk/unity");
purple_prefs_add_int("/plugins/gtk/unity/launcher_count", LAUNCHER_COUNT_SOURCES);
purple_prefs_add_int("/plugins/gtk/unity/messaging_menu_text", MESSAGING_MENU_COUNT);
purple_prefs_add_bool("/plugins/gtk/unity/alert_chat_nick", TRUE);
alert_chat_nick = purple_prefs_get_bool("/plugins/gtk/unity/alert_chat_nick");
mmapp = messaging_menu_app_new("pidgin.desktop");
g_object_ref(mmapp);
messaging_menu_app_register(mmapp);
messaging_menu_text = purple_prefs_get_int("/plugins/gtk/unity/messaging_menu_text");
g_signal_connect(mmapp, "activate-source",
G_CALLBACK(message_source_activated), NULL);
g_signal_connect(mmapp, "status-changed",
G_CALLBACK(messaging_menu_status_changed), NULL);
saved_status = purple_savedstatus_get_current();
status_changed_cb(saved_status);
purple_signal_connect(savedstat_handle, "savedstatus-changed", plugin,
PURPLE_CALLBACK(status_changed_cb), NULL);
launcher = unity_launcher_entry_get_for_desktop_id("pidgin.desktop");
g_object_ref(launcher);
launcher_count = purple_prefs_get_int("/plugins/gtk/unity/launcher_count");
purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin,
PURPLE_CALLBACK(message_displayed_cb), NULL);
purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin,
PURPLE_CALLBACK(message_displayed_cb), NULL);
purple_signal_connect(conv_handle, "sent-im-msg", plugin,
PURPLE_CALLBACK(im_sent_im), NULL);
purple_signal_connect(conv_handle, "sent-chat-msg", plugin,
PURPLE_CALLBACK(chat_sent_im), NULL);
purple_signal_connect(conv_handle, "conversation-created", plugin,
PURPLE_CALLBACK(conv_created), NULL);
purple_signal_connect(conv_handle, "deleting-conversation", plugin,
PURPLE_CALLBACK(deleting_conv), NULL);
while (convs) {
PurpleConversation *conv = (PurpleConversation *)convs->data;
attach_signals(conv);
convs = convs->next;
}
return TRUE;
}
示例6: blist_dock_cb
static void blist_dock_cb(gboolean val) {
if(val) {
purple_debug_info(WINPREFS_PLUGIN_ID, "Blist Docking...\n");
if(purple_prefs_get_int(PREF_BLIST_ON_TOP) != BLIST_TOP_NEVER)
blist_set_ontop(TRUE);
} else {
purple_debug_info(WINPREFS_PLUGIN_ID, "Blist Undocking...\n");
blist_set_ontop(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS);
}
}
示例7: init_plugin
static void
init_plugin(PurplePlugin *plugin)
{
gboolean dates = FALSE, ims = FALSE, chats = FALSE;
purple_prefs_add_none(PREF_ROOT_GPPATH);
purple_prefs_add_none(PREF_ROOT_PPATH);
purple_prefs_add_none(PREF_ROOT_PATH);
if(purple_prefs_exists("/plugins/core/enhanced_history/int")) {
if(strcmp(purple_prefs_get_string("/plugins/core/enhanced_history/string_date"), "no"))
dates = TRUE;
if(strcmp(purple_prefs_get_string("/plugins/core/enhanced_history/string_im"), "no"))
ims = TRUE;
if(strcmp(purple_prefs_get_string("/plugins/core/enhanced_history/string_chat"), "no"))
chats = TRUE;
purple_prefs_add_int(PREF_NUMBER_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/int"));
purple_prefs_add_int(PREF_BYTES_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/bytes"));
purple_prefs_add_int(PREF_MINS_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/mins"));
purple_prefs_add_int(PREF_HOURS_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/hours"));
purple_prefs_add_int(PREF_DAYS_PATH, purple_prefs_get_int("/plugins/core/enhanced_history/days"));
purple_prefs_add_bool(PREF_DATES_PATH, dates);
purple_prefs_add_bool(PREF_IM_PATH, ims);
purple_prefs_add_bool(PREF_CHAT_PATH, chats);
purple_prefs_remove("/plugins/core/enhanced_history/int");
purple_prefs_remove("/plugins/core/enhanced_history/bytes");
purple_prefs_remove("/plugins/core/enhanced_history/mins");
purple_prefs_remove("/plugins/core/enhanced_history/hours");
purple_prefs_remove("/plugins/core/enhanced_history/days");
purple_prefs_remove("/plugins/core/enhanced_history/string_date");
purple_prefs_remove("/plugins/core/enhanced_history/string_im");
purple_prefs_remove("/plugins/core/enhanced_history/string_chat");
purple_prefs_remove("/plugins/core/enhanced_history");
} else {
/* Create these prefs with sensible defaults */
purple_prefs_add_int(PREF_NUMBER_PATH, 10);
purple_prefs_add_int(PREF_BYTES_PATH, 4096);
purple_prefs_add_int(PREF_MINS_PATH, 0);
purple_prefs_add_int(PREF_HOURS_PATH, 0);
purple_prefs_add_int(PREF_DAYS_PATH, 0);
purple_prefs_add_bool(PREF_DATES_PATH, TRUE);
purple_prefs_add_bool(PREF_IM_PATH, TRUE);
purple_prefs_add_bool(PREF_CHAT_PATH, FALSE);
}
info.name = _("Enhanced History");
info.summary = _("An enhanced version of the history plugin.");
info.description = _("An enhanced versoin of the history plugin. Grants ability to "
"select the number of previous conversations to show instead of just one.");
}
示例8: fl_show_with_account
static void
fl_show_with_account(PurpleAccount *account)
{
setup_roomlist(account);
g_signal_handlers_disconnect_matched(G_OBJECT(froomlist.window), G_SIGNAL_MATCH_FUNC,
0, 0, NULL, G_CALLBACK(size_changed_cb), NULL);
gnt_widget_show(froomlist.window);
gnt_screen_resize_widget(froomlist.window,
purple_prefs_get_int(PREF_ROOT "/size/width"),
purple_prefs_get_int(PREF_ROOT "/size/height"));
g_signal_connect(G_OBJECT(froomlist.window), "size_changed", G_CALLBACK(size_changed_cb), NULL);
gnt_window_present(froomlist.window);
}
示例9: blist_visible_cb
/* Listen for the first time the window stops being withdrawn */
static void blist_visible_cb(const char *pref, PurplePrefType type,
gconstpointer value, gpointer user_data) {
if(purple_prefs_get_bool(pref)) {
gtk_appbar_dock(blist_ab,
purple_prefs_get_int(PREF_DBLIST_SIDE));
if(purple_prefs_get_int(PREF_BLIST_ON_TOP)
== BLIST_TOP_DOCKED)
blist_set_ontop(TRUE);
/* We only need to be notified about this once */
purple_prefs_disconnect_callback(blist_visible_cb_id);
}
}
示例10: g_return_val_if_fail
static GdkPixbuf *make_scaled_pixbuf(const guchar * url_text, gsize len)
{
/* make pixbuf */
GdkPixbufLoader *loader;
GdkPixbuf *src = NULL,
*dest = NULL;
g_return_val_if_fail(url_text != NULL, NULL);
g_return_val_if_fail(len > 0, NULL);
loader = gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write(loader, url_text, len, NULL);
gdk_pixbuf_loader_close(loader, NULL);
src = gdk_pixbuf_loader_get_pixbuf(loader);
if (src) {
dest = gdk_pixbuf_scale_simple(src, purple_prefs_get_int(TWITTER_PREF_CONV_ICON_SIZE), purple_prefs_get_int(TWITTER_PREF_CONV_ICON_SIZE), GDK_INTERP_HYPER);
} else {
dest = NULL;
}
g_object_unref(G_OBJECT(loader));
return dest;
}
示例11: purple_sound_play_required
static gboolean
purple_sound_play_required(const PurpleAccount *account)
{
gint pref_status = purple_prefs_get_int("/purple/sound/while_status");
if (pref_status == PURPLE_SOUND_STATUS_ALWAYS)
{
/* Play sounds: Always */
return TRUE;
}
if (account != NULL)
{
PurpleStatus *status = purple_account_get_active_status(account);
if (purple_status_is_online(status))
{
gboolean available = purple_status_is_available(status);
return (( available && pref_status == PURPLE_SOUND_STATUS_AVAILABLE) ||
(!available && pref_status == PURPLE_SOUND_STATUS_AWAY));
}
}
/* We get here a couple of ways. Either the request has been OK'ed
* by purple_sound_play_event() and we're here because the UI has
* called purple_sound_play_file(), or we're here for something
* not related to an account (like testing a sound). */
return TRUE;
}
示例12: set_conv_window_trans
static void set_conv_window_trans(PidginWindow *oldwin, PidginWindow *newwin) {
GtkWidget *win = newwin->window;
/* check prefs to see if we want trans */
if (purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) {
set_wintrans(win, purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA),
TRUE, purple_prefs_get_bool(OPT_WINTRANS_IM_ONTOP));
if (purple_prefs_get_bool(OPT_WINTRANS_IM_SLIDER)) {
add_slider(win);
}
}
/* If we're moving from one window to another,
* add the focus listeners to the new window if not already there */
if (oldwin != NULL && oldwin != newwin) {
if (pidgin_conv_window_get_gtkconv_count(newwin) == 0) {
g_signal_connect(G_OBJECT(win), "focus_in_event",
G_CALLBACK(focus_conv_win_cb), win);
g_signal_connect(G_OBJECT(win), "focus_out_event",
G_CALLBACK(focus_conv_win_cb), win);
}
/* If we've moved the last conversation, cleanup the window */
if (pidgin_conv_window_get_gtkconv_count(oldwin) == 1)
cleanup_conv_window(oldwin);
}
}
示例13: conv_created_cb
static void
conv_created_cb(PurpleConversation *conv, gpointer null)
{
PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
twitter_debug("called\n");
g_return_if_fail(gtkconv != NULL);
gint service = get_service_type(conv);
/* only attach to twitter conversation window */
switch(service) {
case twitter_service:
get_status_with_api((gpointer)conv);
source.id = g_timeout_add_seconds(
purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL),
get_status_with_api, (gpointer)conv);
source.conv = conv;
attach_to_conv(conv, NULL);
break;
case wassr_service:
case identica_service:
case jisko_service:
case ffeed_service:
attach_to_conv(conv, NULL);
break;
default:
twitter_debug("unknown service\n");
break;
}
}
示例14: get_lastfm_ws_info
void
get_lastfm_ws_info(struct TrackInfo* ti)
{
const char *user = purple_prefs_get_string(PREF_LASTFM);
if (!strcmp(user,""))
{
trace("No last.fm user name");
return;
}
trace("Got user name: %s",user);
// Check if it's time to check again
static int count = 0;
if (count < 0)
{
trace("last.fm ratelimit %d",count);
}
else
{
count = count - purple_prefs_get_int(PREF_LASTFM_INTERVAL);
char *url = g_strdup_printf(LASTFM_WS_URL, user, LASTFM_WS_API_KEY);
trace("URL is %s", url);
purple_util_fetch_url_request(url, TRUE, USER_AGENT, FALSE, NULL, FALSE, lastfm_ws_fetch, NULL);
g_free(url);
}
count = count + INTERVAL_SECONDS;
*ti = lastfm_ws_ti;
}
示例15: test_cb
static void
test_cb(GntWidget *button, gpointer null)
{
PurpleSoundEventID id = GPOINTER_TO_INT(gnt_tree_get_selection_data(GNT_TREE(pref_dialog->events)));
FinchSoundEvent * event = &sounds[id];
char *enabled, *file, *tmpfile, *volpref;
gboolean temp_value;
int volume;
enabled = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/enabled/%s",
finch_sound_get_active_profile(), event->pref);
file = g_strdup_printf(FINCH_PREFS_ROOT "/sound/profiles/%s/file/%s",
finch_sound_get_active_profile(), event->pref);
volpref = g_strdup(make_pref("/volume"));
temp_value = purple_prefs_get_bool(enabled);
tmpfile = g_strdup(purple_prefs_get_path(file));
volume = purple_prefs_get_int(volpref);
purple_prefs_set_path(file, event->file);
if (!temp_value) purple_prefs_set_bool(enabled, TRUE);
purple_prefs_set_int(volpref, gnt_slider_get_value(GNT_SLIDER(pref_dialog->volume)));
purple_sound_play_event(id, NULL);
if (!temp_value) purple_prefs_set_bool(enabled, FALSE);
purple_prefs_set_path(file, tmpfile);
purple_prefs_set_int(volpref, volume);
g_free(enabled);
g_free(file);
g_free(tmpfile);
g_free(volpref);
}