gboolean images_set_file_chooser_preview_image(GtkImage *preview_image, GtkFileChooser *file_chooser){ gchar *filename=gtk_file_chooser_get_preview_filename(file_chooser); if(G_STR_EMPTY(filename)){ if(filename) uber_free(filename); filename=gtk_file_chooser_get_filename(file_chooser); if(G_STR_EMPTY(filename)){ if(filename) uber_free(filename); return FALSE; } } GdkPixbuf *pixbuf=gdk_pixbuf_new_from_file_at_size(filename, 128, 128, NULL); uber_free(filename); if(!pixbuf) return FALSE; gtk_image_set_from_pixbuf(preview_image, pixbuf); uber_object_unref(pixbuf); gtk_file_chooser_set_preview_widget_active(file_chooser, TRUE); return TRUE; }/*images_set_file_chooser_preview_image(preview_image, file_chooser);*/
EmpathyChat * empathy_chat_window_find_chat (McAccount *account, const gchar *id) { GList *l; g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (!G_STR_EMPTY (id), NULL); for (l = chat_windows; l; l = l->next) { EmpathyChatWindowPriv *priv; EmpathyChatWindow *window; GList *ll; window = l->data; priv = GET_PRIV (window); for (ll = priv->chats; ll; ll = ll->next) { EmpathyChat *chat; chat = ll->data; if (empathy_account_equal (account, empathy_chat_get_account (chat)) && !tp_strdiff (id, empathy_chat_get_id (chat))) { return chat; } } } return NULL; }
static void new_chatroom_dialog_join (EmpathyNewChatroomDialog *dialog) { EmpathyAccountChooser *account_chooser; McAccount *account; const gchar *room; const gchar *server = NULL; gchar *room_name = NULL; room = gtk_entry_get_text (GTK_ENTRY (dialog->entry_room)); server = gtk_entry_get_text (GTK_ENTRY (dialog->entry_server)); account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser); account = empathy_account_chooser_get_account (account_chooser); if (!G_STR_EMPTY (server)) { room_name = g_strconcat (room, "@", server, NULL); } else { room_name = g_strdup (room); } DEBUG ("Requesting channel for '%s'", room_name); empathy_dispatcher_join_muc (account, room_name, NULL, NULL); g_free (room_name); }
static void images_validate_filename(gchar **image_filename){ if(!G_STR_EMPTY(*image_filename)) return; if(*image_filename) g_free(*image_filename); *image_filename=images_get_unknown_image_filename(); }/*images_validate_filename*/
static void account_widget_password_changed_cb (GtkWidget *entry, GtkWidget *button) { const gchar *str; str = gtk_entry_get_text (GTK_ENTRY (entry)); gtk_widget_set_sensitive (button, !G_STR_EMPTY (str)); }
static void new_chatroom_dialog_entry_changed_cb (GtkWidget *entry, EmpathyNewChatroomDialog *dialog) { if (entry == dialog->entry_room) { const gchar *room; room = gtk_entry_get_text (GTK_ENTRY (dialog->entry_room)); gtk_widget_set_sensitive (dialog->button_join, !G_STR_EMPTY (room)); /* FIXME: Select the room in the list */ } }
void empathy_smiley_manager_add (EmpathySmileyManager *manager, const gchar *icon_name, const gchar *first_str, ...) { GdkPixbuf *smiley; va_list var_args; g_return_if_fail (EMPATHY_IS_SMILEY_MANAGER (manager)); g_return_if_fail (!G_STR_EMPTY (icon_name)); g_return_if_fail (!G_STR_EMPTY (first_str)); smiley = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_MENU); if (smiley) { va_start (var_args, first_str); smiley_manager_add_valist (manager, smiley, first_str, var_args); va_end (var_args); g_object_unref (smiley); } }
EmpathyImportAccountData * empathy_import_account_data_new (const gchar *source) { EmpathyImportAccountData *data; g_assert (!G_STR_EMPTY(source)); data = g_slice_new0 (EmpathyImportAccountData); data->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) tp_g_value_slice_free); data->source = g_strdup(source); return data; }
void empathy_smiley_manager_add_from_pixbuf (EmpathySmileyManager *manager, GdkPixbuf *smiley, const gchar *first_str, ...) { va_list var_args; g_return_if_fail (EMPATHY_IS_SMILEY_MANAGER (manager)); g_return_if_fail (GDK_IS_PIXBUF (smiley)); g_return_if_fail (!G_STR_EMPTY (first_str)); va_start (var_args, first_str); smiley_manager_add_valist (manager, smiley, first_str, var_args); va_end (var_args); }
static gboolean account_widget_entry_focus_cb (GtkWidget *widget, GdkEventFocus *event, McAccount *account) { const gchar *str; const gchar *param_name; str = gtk_entry_get_text (GTK_ENTRY (widget)); param_name = g_object_get_data (G_OBJECT (widget), "param_name"); if (G_STR_EMPTY (str)) { gchar *value = NULL; mc_account_unset_param (account, param_name); mc_account_get_param_string (account, param_name, &value); DEBUG ("Unset %s and restore to %s", param_name, value); gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); g_free (value); } else { McProfile *profile; const gchar *domain = NULL; gchar *dup_str = NULL; profile = mc_account_get_profile (account); if (mc_profile_get_capabilities (profile) & MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT) { domain = mc_profile_get_default_account_domain (profile); } if (domain && !strstr (str, "@") && strcmp (param_name, "account") == 0) { DEBUG ("Adding @%s suffix to account", domain); str = dup_str = g_strconcat (str, "@", domain, NULL); gtk_entry_set_text (GTK_ENTRY (widget), str); } DEBUG ("Setting %s to %s", param_name, strstr (param_name, "password") ? "***" : str); mc_account_set_param_string (account, param_name, str); g_free (dup_str); g_object_unref (profile); } return FALSE; }
static void new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog) { EmpathyAccountChooser *account_chooser; McAccount *account; McProfile *profile; const gchar *protocol; const gchar *room; account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser); account = empathy_account_chooser_get_account (account_chooser); profile = mc_account_get_profile (account); protocol = mc_profile_get_protocol_name (profile); gtk_entry_set_text (GTK_ENTRY (dialog->entry_server), ""); /* hardcode here known protocols */ if (strcmp (protocol, "jabber") == 0) { gtk_widget_set_sensitive (dialog->entry_server, TRUE); gtk_widget_show (dialog->vbox_browse); } else if (strcmp (protocol, "local-xmpp") == 0) { gtk_widget_set_sensitive (dialog->entry_server, FALSE); gtk_widget_show (dialog->vbox_browse); } else if (strcmp (protocol, "irc") == 0) { gtk_widget_set_sensitive (dialog->entry_server, FALSE); gtk_widget_show (dialog->vbox_browse); } else { gtk_widget_set_sensitive (dialog->entry_server, TRUE); gtk_widget_show (dialog->vbox_browse); } room = gtk_entry_get_text (GTK_ENTRY (dialog->entry_room)); gtk_widget_set_sensitive (dialog->button_join, !G_STR_EMPTY (room)); /* Final set up of the dialog */ gtk_widget_grab_focus (dialog->entry_room); g_object_unref (account); g_object_unref (profile); }
static void contact_list_view_row_has_child_toggled_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, EmpathyContactListView *view) { EmpathyContactListViewPriv *priv = GET_PRIV (view); gboolean is_group = FALSE; gchar *name = NULL; gtk_tree_model_get (model, iter, EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group, EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name, -1); if (!is_group || G_STR_EMPTY (name)) { g_free (name); return; } if (!(priv->list_features & EMPATHY_CONTACT_LIST_FEATURE_GROUPS_SAVE) || empathy_contact_group_get_expanded (name)) { g_signal_handlers_block_by_func (view, contact_list_view_row_expand_or_collapse_cb, GINT_TO_POINTER (TRUE)); gtk_tree_view_expand_row (GTK_TREE_VIEW (view), path, TRUE); g_signal_handlers_unblock_by_func (view, contact_list_view_row_expand_or_collapse_cb, GINT_TO_POINTER (TRUE)); } else { g_signal_handlers_block_by_func (view, contact_list_view_row_expand_or_collapse_cb, GINT_TO_POINTER (FALSE)); gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path); g_signal_handlers_unblock_by_func (view, contact_list_view_row_expand_or_collapse_cb, GINT_TO_POINTER (FALSE)); } g_free (name); }
void empathy_account_widget_add_forget_button (McAccount *account, GladeXML *glade, const gchar *button, const gchar *entry) { GtkWidget *button_forget; GtkWidget *entry_password; gchar *password = NULL; button_forget = glade_xml_get_widget (glade, button); entry_password = glade_xml_get_widget (glade, entry); mc_account_get_param_string (account, "password", &password); gtk_widget_set_sensitive (button_forget, !G_STR_EMPTY (password)); g_free (password); g_signal_connect (button_forget, "clicked", G_CALLBACK (account_widget_forget_clicked_cb), entry_password); g_signal_connect (entry_password, "changed", G_CALLBACK (account_widget_password_changed_cb), button_forget); }
void twitux_account_dialog_show (GtkWindow *parent) { static TwituxAccount *act; GtkBuilder *ui; TwituxConf *conf; gchar *username; gchar *password; if (act) { gtk_window_present (GTK_WINDOW (act->dialog)); return; } act = g_new0 (TwituxAccount, 1); /* Get widgets */ ui = twitux_xml_get_file (XML_FILE, "account_dialog", &act->dialog, "username_entry", &act->username, "password_entry", &act->password, "show_password_checkbutton", &act->show_password, NULL); /* Connect the signals */ twitux_xml_connect (ui, act, "account_dialog", "destroy", account_destroy_cb, "account_dialog", "response", account_response_cb, "show_password_checkbutton", "toggled", account_show_password_cb, NULL); g_object_unref (ui); g_object_add_weak_pointer (G_OBJECT (act->dialog), (gpointer) &act); gtk_window_set_transient_for (GTK_WINDOW (act->dialog), parent); /* * Check to see if the username & pasword are already in gconf, * and if so fill in the appropriate entry widget. */ conf = twitux_conf_get (); twitux_conf_get_string (conf, TWITUX_PREFS_AUTH_USER_ID, &username); gtk_entry_set_text (GTK_ENTRY (act->username), username ? username : ""); #ifdef HAVE_GNOME_KEYRING /* If there is no username, don't bother searching for the password */ if (G_STR_EMPTY (username)) { username = NULL; password = NULL; } else { if (!(twitux_keyring_get_password (username, &password))) { password = NULL; } } #else twitux_conf_get_string (conf, TWITUX_PREFS_AUTH_PASSWORD, &password); #endif gtk_entry_set_text (GTK_ENTRY (act->password), password ? password : ""); g_free (username); g_free (password); /* Ok, let's go ahead and show it */ gtk_widget_show (act->dialog); }