| 164 info = gplugin_plugin_get_info(plugin); |
164 info = gplugin_plugin_get_info(plugin); |
| 165 value = g_variant_new_string(gplugin_plugin_info_get_name(info)); |
165 value = g_variant_new_string(gplugin_plugin_info_get_name(info)); |
| 166 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL, |
166 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL, |
| 167 g_variant_ref_sink(value)); |
167 g_variant_ref_sink(value)); |
| 168 |
168 |
| 169 value = g_variant_new_string(gplugin_plugin_info_get_id(info)); |
|
| 170 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION_NAMESPACE, |
|
| 171 g_variant_ref_sink(value)); |
|
| 172 |
|
| 173 g_object_unref(info); |
169 g_object_unref(info); |
| 174 } |
170 } |
| 175 |
171 |
| 176 static void |
172 static void |
| 177 pidgin_plugins_menu_get_item_links(GMenuModel *model, gint index, |
173 pidgin_plugins_menu_get_item_links(GMenuModel *model, gint index, |
| 192 } |
188 } |
| 193 |
189 |
| 194 info = gplugin_plugin_get_info(plugin); |
190 info = gplugin_plugin_get_info(plugin); |
| 195 purple_info = PURPLE_PLUGIN_INFO(info); |
191 purple_info = PURPLE_PLUGIN_INFO(info); |
| 196 |
192 |
| |
193 /* We need to use a section for the ACTION_NAMESPACE attribute to work, so |
| |
194 * create a menu, and add a new section item to it with the menu from the |
| |
195 * plugin, then set the ACTION_NAMESPACE attribute. Finally return the menu |
| |
196 * as the submenu. |
| |
197 */ |
| 197 actions_model = purple_plugin_info_get_action_menu(purple_info); |
198 actions_model = purple_plugin_info_get_action_menu(purple_info); |
| 198 if(G_IS_MENU_MODEL(actions_model)) { |
199 if(G_IS_MENU_MODEL(actions_model)) { |
| 199 g_hash_table_insert(*links, G_MENU_LINK_SUBMENU, actions_model); |
200 GMenu *menu = NULL; |
| |
201 GMenuItem *section = NULL; |
| |
202 |
| |
203 menu = g_menu_new(); |
| |
204 section = g_menu_item_new_section(NULL, actions_model); |
| |
205 g_menu_item_set_attribute(section, G_MENU_ATTRIBUTE_ACTION_NAMESPACE, |
| |
206 "s", gplugin_plugin_info_get_id(info)); |
| |
207 g_menu_append_item(menu, section); |
| |
208 |
| |
209 g_hash_table_insert(*links, G_MENU_LINK_SUBMENU, menu); |
| 200 } |
210 } |
| 201 |
211 |
| 202 g_object_unref(info); |
212 g_object_unref(info); |
| 203 } |
213 } |
| 204 |
214 |