Don't like ads? PRO users don't see any ads ;-)
Guest

pidgin-blist-add-dialog-3.patch

By: a guest on Jul 8th, 2012  |  syntax: Diff  |  size: 9.64 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
  2. --- a/libpurple/protocols/gg/gg.c
  3. +++ b/libpurple/protocols/gg/gg.c
  4. @@ -2128,6 +2128,7 @@
  5.         GHashTable *table;
  6.         table = g_hash_table_new(g_str_hash, g_str_equal);
  7.         g_hash_table_insert(table, "login_label", (gpointer)_("GG number..."));
  8. +       g_hash_table_insert(table, "buddy_username_label", (gpointer)_("GG n_umber:"));
  9.         return table;
  10.  }
  11.  
  12. diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
  13. --- a/libpurple/protocols/msn/msn.c
  14. +++ b/libpurple/protocols/msn/msn.c
  15. @@ -149,6 +149,7 @@
  16.         table = g_hash_table_new(g_str_hash, g_str_equal);
  17.  
  18.         g_hash_table_insert(table, "login_label", (gpointer)_("Email Address..."));
  19. +       g_hash_table_insert(table, "buddy_username_label", (gpointer)_("Email Address:"));
  20.  
  21.         return table;
  22.  }
  23. diff --git a/libpurple/protocols/mxit/mxit.c b/libpurple/protocols/mxit/mxit.c
  24. --- a/libpurple/protocols/mxit/mxit.c
  25. +++ b/libpurple/protocols/mxit/mxit.c
  26. @@ -597,6 +597,7 @@
  27.         table = g_hash_table_new( g_str_hash, g_str_equal );
  28.  
  29.         g_hash_table_insert( table, "login_label", (gpointer)_( "Your MXit ID..." ) );
  30. +       g_hash_table_insert( table, "buddy_username_label", (gpointer)_( "MXit ID:" ) );
  31.  
  32.         return table;
  33.  }
  34. diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c
  35. --- a/libpurple/protocols/myspace/myspace.c
  36. +++ b/libpurple/protocols/myspace/myspace.c
  37. @@ -2999,6 +2999,7 @@
  38.         table = g_hash_table_new(g_str_hash, g_str_equal);
  39.  
  40.         g_hash_table_insert(table, "login_label", (gpointer)_("Email Address..."));
  41. +       g_hash_table_insert(table, "buddy_username_label", (gpointer)_("Email Address:"));
  42.  
  43.         return table;
  44.  }
  45. diff --git a/libpurple/protocols/oscar/libicq.c b/libpurple/protocols/oscar/libicq.c
  46. --- a/libpurple/protocols/oscar/libicq.c
  47. +++ b/libpurple/protocols/oscar/libicq.c
  48. @@ -33,6 +33,7 @@
  49.         GHashTable *table;
  50.         table = g_hash_table_new(g_str_hash, g_str_equal);
  51.         g_hash_table_insert(table, "login_label", (gpointer)_("ICQ UIN..."));
  52. +       g_hash_table_insert(table, "buddy_username_label", (gpointer)_("ICQ _UIN:"));
  53.         return table;
  54.  }
  55.  
  56. diff --git a/libpurple/protocols/yahoo/libyahoo.c b/libpurple/protocols/yahoo/libyahoo.c
  57. --- a/libpurple/protocols/yahoo/libyahoo.c
  58. +++ b/libpurple/protocols/yahoo/libyahoo.c
  59. @@ -164,6 +164,7 @@
  60.         GHashTable *table;
  61.         table = g_hash_table_new(g_str_hash, g_str_equal);
  62.         g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo ID..."));
  63. +       g_hash_table_insert(table, "buddy_username_label", (gpointer)_("Yahoo ID:"));
  64.         return table;
  65.  }
  66.  
  67. diff --git a/libpurple/protocols/yahoo/libyahoojp.c b/libpurple/protocols/yahoo/libyahoojp.c
  68. --- a/libpurple/protocols/yahoo/libyahoojp.c
  69. +++ b/libpurple/protocols/yahoo/libyahoojp.c
  70. @@ -60,6 +60,7 @@
  71.         GHashTable *table;
  72.         table = g_hash_table_new(g_str_hash, g_str_equal);
  73.         g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo JAPAN ID..."));
  74. +       g_hash_table_insert(table, "buddy_username_label", (gpointer)_("Yahoo JAPAN ID:"));
  75.         return table;
  76.  }
  77.  
  78. diff --git a/libpurple/prpl.c b/libpurple/prpl.c
  79. --- a/libpurple/prpl.c
  80. +++ b/libpurple/prpl.c
  81. @@ -646,3 +646,30 @@
  82.  
  83.         return NULL;
  84.  }
  85. +
  86. +gchar * purple_prpl_get_text(PurplePlugin *plugin, PurpleAccount *account,
  87. +       const char *key)
  88. +{
  89. +       GHashTable *table;
  90. +       const char *text;
  91. +       PurplePluginProtocolInfo *prpl_info;
  92. +      
  93. +       g_return_val_if_fail(plugin != NULL || account != NULL, NULL);
  94. +       g_return_val_if_fail(key != NULL, NULL);
  95. +      
  96. +       if (plugin == NULL)
  97. +               plugin = purple_find_prpl(
  98. +                       purple_account_get_protocol_id(account));
  99. +       prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin);
  100. +      
  101. +       if (!PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_account_text_table))
  102. +               return NULL;
  103. +      
  104. +       table = prpl_info->get_account_text_table(account);
  105. +       text = g_hash_table_lookup(table, key);
  106. +       if (text != NULL)
  107. +               text = g_strdup(text);
  108. +      
  109. +       g_hash_table_destroy(table);
  110. +       return text;
  111. +}
  112. diff --git a/libpurple/prpl.h b/libpurple/prpl.h
  113. --- a/libpurple/prpl.h
  114. +++ b/libpurple/prpl.h
  115. @@ -947,6 +947,23 @@
  116.   */
  117.  PurplePlugin *purple_find_prpl(const char *id);
  118.  
  119. +/**
  120. + * Lookups for string in account text table.
  121. + *
  122. + * At least @a plugin or @a account parameter must be supplied, returned pointer
  123. + * must be free'd with g_free.
  124. + *
  125. + * @param plugin   The protocol plugin related to string.
  126. + * @param account  The account related to string.
  127. + * @param key      The string name to lookup.
  128. + *
  129. + * @return Found string (must be freed), or NULL, if it wasn't found.
  130. + *
  131. + * @see get_account_text_table
  132. + */
  133. +gchar * purple_prpl_get_text(PurplePlugin *plugin, PurpleAccount *account,
  134. +       const char *key);
  135. +
  136.  /*@}*/
  137.  
  138.  G_END_DECLS
  139. diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
  140. --- a/pidgin/gtkaccount.c
  141. +++ b/pidgin/gtkaccount.c
  142. @@ -267,19 +267,14 @@
  143.  static gboolean
  144.  username_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog)
  145.  {
  146. -       GHashTable *table;
  147. -       const char *label;
  148. -
  149. -       table = dialog->prpl_info->get_account_text_table(NULL);
  150. -       label = g_hash_table_lookup(table, "login_label");
  151. -
  152. -       if(!strcmp(gtk_entry_get_text(GTK_ENTRY(widget)), label)) {
  153. +       gchar *label = purple_prpl_get_text(dialog->plugin, NULL, "login_label");
  154. +
  155. +       if(label && !strcmp(gtk_entry_get_text(GTK_ENTRY(widget)), label)) {
  156.                 gtk_entry_set_text(GTK_ENTRY(widget), "");
  157.                 gtk_widget_modify_text(widget, GTK_STATE_NORMAL,NULL);
  158.         }
  159.  
  160. -       g_hash_table_destroy(table);
  161. -
  162. +       g_free(label);
  163.         return FALSE;
  164.  }
  165.  
  166. @@ -311,13 +306,9 @@
  167.  username_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog)
  168.  {
  169.         GdkColor color = {0, 34952, 35466, 34181};
  170. -       GHashTable *table = NULL;
  171. -       const char *label = NULL;
  172. -
  173. -       if(PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(dialog->prpl_info, get_account_text_table)) {
  174. -               table = dialog->prpl_info->get_account_text_table(NULL);
  175. -               label = g_hash_table_lookup(table, "login_label");
  176. -
  177. +       gchar *label = purple_prpl_get_text(dialog->plugin, NULL, "login_label");
  178. +
  179. +       if(label) {
  180.                 if (*gtk_entry_get_text(GTK_ENTRY(widget)) == '\0') {
  181.                         /* We have to avoid hitting the username_changed_cb function
  182.                          * because it enables buttons we don't want enabled yet ;)
  183. @@ -328,10 +319,9 @@
  184.                         g_signal_handlers_unblock_by_func(widget, G_CALLBACK(username_changed_cb), dialog);
  185.                         gtk_widget_modify_text(widget, GTK_STATE_NORMAL, &color);
  186.                 }
  187. -
  188. -               g_hash_table_destroy(table);
  189.         }
  190.  
  191. +       g_free(label);
  192.         return FALSE;
  193.  }
  194.  
  195. @@ -528,10 +518,7 @@
  196.         if (!username && dialog->prpl_info
  197.                         && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(dialog->prpl_info, get_account_text_table)) {
  198.                 GdkColor color = {0, 34952, 35466, 34181};
  199. -               GHashTable *table;
  200. -               const char *label;
  201. -               table = dialog->prpl_info->get_account_text_table(NULL);
  202. -               label = g_hash_table_lookup(table, "login_label");
  203. +               gchar *label = purple_prpl_get_text(dialog->plugin, NULL, "login_label");
  204.  
  205.                 gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), label);
  206.                 g_signal_connect(G_OBJECT(dialog->username_entry), "focus-in-event",
  207. @@ -539,7 +526,8 @@
  208.                 g_signal_connect(G_OBJECT(dialog->username_entry), "focus-out-event",
  209.                                 G_CALLBACK(username_nofocus_cb), dialog);
  210.                 gtk_widget_modify_text(dialog->username_entry, GTK_STATE_NORMAL, &color);
  211. -               g_hash_table_destroy(table);
  212. +              
  213. +               g_free(label);
  214.         }
  215.  
  216.         g_signal_connect(G_OBJECT(dialog->username_entry), "changed",
  217. diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c
  218. --- a/pidgin/gtkblist.c
  219. +++ b/pidgin/gtkblist.c
  220. @@ -85,8 +85,10 @@
  221.         PidginBlistRequestData rq_data;
  222.         GtkWidget *combo;
  223.         GtkWidget *entry;
  224. +       GtkWidget *entry_label;
  225.         GtkWidget *entry_for_alias;
  226.         GtkWidget *entry_for_invite;
  227. +       GtkWidget *entry_for_invite_box;
  228.  
  229.  } PidginAddBuddyData;
  230.  
  231. @@ -7044,6 +7046,7 @@
  232.         PurplePlugin *prpl = NULL;
  233.         PurplePluginProtocolInfo *prpl_info = NULL;
  234.         gboolean invite_enabled = TRUE;
  235. +       gchar *username_label = NULL;
  236.  
  237.         /* Save our account */
  238.         data->rq_data.account = account;
  239. @@ -7053,11 +7056,21 @@
  240.         if (pc)
  241.                 prpl = purple_connection_get_prpl(pc);
  242.         if (prpl)
  243. +       {
  244.                 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
  245. +               username_label = purple_prpl_get_text(prpl, account, "buddy_username_label");
  246. +       }
  247.         if (prpl_info && !(prpl_info->options & OPT_PROTO_INVITE_MESSAGE))
  248.                 invite_enabled = FALSE;
  249.  
  250. -       gtk_widget_set_sensitive(data->entry_for_invite, invite_enabled);
  251. +       gtk_widget_set_visible(data->entry_for_invite_box, invite_enabled);
  252. +
  253. +       if (username_label)
  254. +               gtk_label_set_text_with_mnemonic(GTK_LABEL(data->entry_label), username_label);
  255. +       else
  256. +               gtk_label_set_text_with_mnemonic(GTK_LABEL(data->entry_label), _("Buddy's _username:"));
  257. +      
  258. +       g_free(username_label);
  259.  }
  260.  
  261.  static void
  262. @@ -7169,9 +7182,10 @@
  263.                          G_CALLBACK(destroy_add_buddy_dialog_cb), data);
  264.  
  265.         data->entry = gtk_entry_new();
  266. +       data->entry_label = NULL;
  267.  
  268.         pidgin_add_widget_to_vbox(data->rq_data.vbox, _("Buddy's _username:"),
  269. -               data->rq_data.sg, data->entry, TRUE, NULL);
  270. +               data->rq_data.sg, data->entry, TRUE, &data->entry_label);
  271.         gtk_widget_grab_focus(data->entry);
  272.  
  273.         if (username != NULL)
  274. @@ -7198,9 +7212,9 @@
  275.                 gtk_widget_grab_focus(GTK_WIDGET(data->entry_for_alias));
  276.  
  277.         data->entry_for_invite = gtk_entry_new();
  278. -       pidgin_add_widget_to_vbox(data->rq_data.vbox, _("(Optional) _Invite message:"),
  279. -                                 data->rq_data.sg, data->entry_for_invite, TRUE,
  280. -                                 NULL);
  281. +       data->entry_for_invite_box = pidgin_add_widget_to_vbox(
  282. +               data->rq_data.vbox, _("(Optional) _Invite message:"),
  283. +               data->rq_data.sg, data->entry_for_invite, TRUE, NULL);
  284.  
  285.         data->combo = pidgin_text_combo_box_entry_new(group, groups_tree());
  286.         pidgin_add_widget_to_vbox(data->rq_data.vbox, _("Add buddy to _group:"),