| 100 { |
100 { |
| 101 PidginAccountsDisabledMenu *menu = NULL; |
101 PidginAccountsDisabledMenu *menu = NULL; |
| 102 PurpleAccount *account = NULL; |
102 PurpleAccount *account = NULL; |
| 103 PurpleProtocol *protocol = NULL; |
103 PurpleProtocol *protocol = NULL; |
| 104 GVariant *value = NULL; |
104 GVariant *value = NULL; |
| 105 const gchar *account_name = NULL, *protocol_name = NULL; |
105 const char *account_name = NULL; |
| |
106 const char *protocol_name = N_("Unknown"); |
| 106 |
107 |
| 107 menu = PIDGIN_ACCOUNTS_DISABLED_MENU(model); |
108 menu = PIDGIN_ACCOUNTS_DISABLED_MENU(model); |
| 108 |
109 |
| 109 /* Create our hash table of attributes to return. */ |
110 /* Create our hash table of attributes to return. */ |
| 110 *attributes = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, |
111 *attributes = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, |
| 129 if(account == NULL) { |
130 if(account == NULL) { |
| 130 return; |
131 return; |
| 131 } |
132 } |
| 132 |
133 |
| 133 account_name = purple_account_get_username(account); |
134 account_name = purple_account_get_username(account); |
| 134 protocol_name = purple_account_get_protocol_name(account); |
135 protocol = purple_account_get_protocol(account); |
| |
136 if(PURPLE_IS_PROTOCOL(protocol)) { |
| |
137 protocol_name = purple_protocol_get_name(protocol); |
| |
138 |
| |
139 value = g_variant_new_printf("%s", purple_protocol_get_icon_name(protocol)); |
| |
140 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ICON, |
| |
141 g_variant_ref_sink(value)); |
| |
142 } |
| 135 |
143 |
| 136 /* translators: This format string is intended to contain the account |
144 /* translators: This format string is intended to contain the account |
| 137 * name followed by the protocol name to uniquely identify a specific |
145 * name followed by the protocol name to uniquely identify a specific |
| 138 * account. |
146 * account. |
| 139 */ |
147 */ |
| 140 value = g_variant_new_printf(_("%s (%s)"), account_name, protocol_name); |
148 value = g_variant_new_printf(_("%s (%s)"), account_name, _(protocol_name)); |
| 141 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL, |
149 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL, |
| 142 g_variant_ref_sink(value)); |
150 g_variant_ref_sink(value)); |
| 143 |
151 |
| 144 value = g_variant_new_string("app.enable-account"); |
152 value = g_variant_new_string("app.enable-account"); |
| 145 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION, |
153 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION, |
| 146 g_variant_ref_sink(value)); |
154 g_variant_ref_sink(value)); |
| 147 |
155 |
| 148 value = g_variant_new_printf("%s", purple_account_get_id(account)); |
156 value = g_variant_new_printf("%s", purple_account_get_id(account)); |
| 149 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_TARGET, |
157 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_TARGET, |
| 150 g_variant_ref_sink(value)); |
158 g_variant_ref_sink(value)); |
| 151 |
|
| 152 protocol = purple_account_get_protocol(account); |
|
| 153 if(protocol != NULL) { |
|
| 154 value = g_variant_new_printf("%s", purple_protocol_get_icon_name(protocol)); |
|
| 155 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ICON, |
|
| 156 g_variant_ref_sink(value)); |
|
| 157 } |
|
| 158 } |
159 } |
| 159 |
160 |
| 160 static void |
161 static void |
| 161 pidgin_accounts_disabled_menu_get_item_links(G_GNUC_UNUSED GMenuModel *model, |
162 pidgin_accounts_disabled_menu_get_item_links(G_GNUC_UNUSED GMenuModel *model, |
| 162 G_GNUC_UNUSED gint index, |
163 G_GNUC_UNUSED gint index, |