comparison pidgin/gtkaccount.c @ 32672:3828a61c44da

A boring and large patch so I can merge heads.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 23 Dec 2011 08:21:58 +0000
parents e2a1510da13d
children
comparison
equal deleted inserted replaced
32671:0e69949b3e61 32672:3828a61c44da
165 static void add_protocol_options(AccountPrefsDialog *dialog); 165 static void add_protocol_options(AccountPrefsDialog *dialog);
166 static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent); 166 static void add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent);
167 static void add_voice_options(AccountPrefsDialog *dialog); 167 static void add_voice_options(AccountPrefsDialog *dialog);
168 168
169 static const char * 169 static const char *
170 xmpp_default_domain_hackery(GtkWidget *protocol_combo) 170 google_talk_default_domain_hackery(GtkWidget *protocol_combo, const char *value_if_gtalk)
171 { 171 {
172 GtkTreeModel *model; 172 GtkTreeModel *model;
173 GtkTreeIter iter; 173 GtkTreeIter iter;
174 const char *value = NULL; 174 const char *value = NULL;
175 175
183 char *item_name = NULL; 183 char *item_name = NULL;
184 184
185 gtk_tree_model_get(model, &iter, 1, &item_name, -1); 185 gtk_tree_model_get(model, &iter, 1, &item_name, -1);
186 if (item_name) { 186 if (item_name) {
187 if (!strcmp(item_name, _("Google Talk"))) 187 if (!strcmp(item_name, _("Google Talk")))
188 value = "gmail.com"; 188 value = value_if_gtalk;
189 g_free(item_name);
190 }
191 if (item_name) {
192 if (!strcmp(item_name, _("Facebook")))
193 value = "chat.facebook.com";
194 g_free(item_name); 189 g_free(item_name);
195 } 190 }
196 /* If it's not GTalk, but still Jabber then the value is not NULL, it's empty */ 191 /* If it's not GTalk, but still Jabber then the value is not NULL, it's empty */
197 if (NULL == value) 192 if (NULL == value)
198 value = ""; 193 value = "";
388 383
389 static void 384 static void
390 account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, 385 account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
391 GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog) 386 GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog)
392 { 387 {
393 const gchar *name = (gchar *) gtk_selection_data_get_data(sd); 388 gchar *name = (gchar *)sd->data;
394 gint length = gtk_selection_data_get_length(sd); 389
395 gint format = gtk_selection_data_get_format(sd); 390 if ((sd->length >= 0) && (sd->format == 8)) {
396
397 if (length >= 0 && format == 8) {
398 /* Well, it looks like the drag event was cool. 391 /* Well, it looks like the drag event was cool.
399 * Let's do something with it */ 392 * Let's do something with it */
400 if (!g_ascii_strncasecmp(name, "file://", 7)) { 393 if (!g_ascii_strncasecmp(name, "file://", 7)) {
401 GError *converr = NULL; 394 GError *converr = NULL;
402 gchar *tmp, *rtmp; 395 gchar *tmp, *rtmp;
598 if (value == NULL) 591 if (value == NULL)
599 value = purple_account_user_split_get_default_value(split); 592 value = purple_account_user_split_get_default_value(split);
600 593
601 /* Google Talk default domain hackery! */ 594 /* Google Talk default domain hackery! */
602 if (!strcmp(_("Domain"), purple_account_user_split_get_text(split)) && !value) 595 if (!strcmp(_("Domain"), purple_account_user_split_get_text(split)) && !value)
603 value = xmpp_default_domain_hackery(dialog->protocol_menu); 596 value = google_talk_default_domain_hackery(dialog->protocol_menu, "gmail.com");
604 597
605 if (value != NULL) 598 if (value != NULL)
606 gtk_entry_set_text(GTK_ENTRY(entry), value); 599 gtk_entry_set_text(GTK_ENTRY(entry), value);
607 } 600 }
608 601
1087 1080
1088 if (dialog->new_proxy_type == PURPLE_PROXY_USE_GLOBAL || 1081 if (dialog->new_proxy_type == PURPLE_PROXY_USE_GLOBAL ||
1089 dialog->new_proxy_type == PURPLE_PROXY_NONE || 1082 dialog->new_proxy_type == PURPLE_PROXY_NONE ||
1090 dialog->new_proxy_type == PURPLE_PROXY_USE_ENVVAR) { 1083 dialog->new_proxy_type == PURPLE_PROXY_USE_ENVVAR) {
1091 1084
1092 gtk_widget_hide(dialog->proxy_vbox); 1085 gtk_widget_hide_all(dialog->proxy_vbox);
1093 } 1086 }
1094 else 1087 else
1095 gtk_widget_show_all(dialog->proxy_vbox); 1088 gtk_widget_show_all(dialog->proxy_vbox);
1096 } 1089 }
1097 1090
1790 static void 1783 static void
1791 drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx, 1784 drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx,
1792 GtkSelectionData *data, guint info, guint time, 1785 GtkSelectionData *data, guint info, guint time,
1793 AccountsWindow *dialog) 1786 AccountsWindow *dialog)
1794 { 1787 {
1795 GdkAtom target = gtk_selection_data_get_target(data); 1788 if (data->target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE)) {
1796
1797 if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE)) {
1798 GtkTreeRowReference *ref; 1789 GtkTreeRowReference *ref;
1799 GtkTreePath *source_row; 1790 GtkTreePath *source_row;
1800 GtkTreeIter iter; 1791 GtkTreeIter iter;
1801 PurpleAccount *account = NULL; 1792 PurpleAccount *account = NULL;
1802 GValue val; 1793 GValue val;
1863 static void 1854 static void
1864 drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx, 1855 drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx,
1865 guint x, guint y, GtkSelectionData *sd, 1856 guint x, guint y, GtkSelectionData *sd,
1866 guint info, guint t, AccountsWindow *dialog) 1857 guint info, guint t, AccountsWindow *dialog)
1867 { 1858 {
1868 GdkAtom target = gtk_selection_data_get_target(sd); 1859 if (sd->target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE) && sd->data) {
1869 const guchar *data = gtk_selection_data_get_data(sd);
1870
1871 if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE) && data) {
1872 gint dest_index; 1860 gint dest_index;
1873 PurpleAccount *a = NULL; 1861 PurpleAccount *a = NULL;
1874 GtkTreePath *path = NULL; 1862 GtkTreePath *path = NULL;
1875 GtkTreeViewDropPosition position; 1863 GtkTreeViewDropPosition position;
1876 1864
1877 memcpy(&a, data, sizeof(a)); 1865 memcpy(&a, sd->data, sizeof(a));
1878 1866
1879 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, 1867 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y,
1880 &path, &position)) { 1868 &path, &position)) {
1881 1869
1882 GtkTreeIter iter; 1870 GtkTreeIter iter;
2762 g_hash_table_destroy(account_pref_wins); 2750 g_hash_table_destroy(account_pref_wins);
2763 2751
2764 purple_signals_disconnect_by_handle(pidgin_account_get_handle()); 2752 purple_signals_disconnect_by_handle(pidgin_account_get_handle());
2765 purple_signals_unregister_by_instance(pidgin_account_get_handle()); 2753 purple_signals_unregister_by_instance(pidgin_account_get_handle());
2766 } 2754 }
2755