static void impl_deactivate (RBPlugin *bplugin, RBShell *shell) { RBIpodPlugin *plugin = RB_IPOD_PLUGIN (bplugin); RBRemovableMediaManager *rmm = NULL; GtkUIManager *uimanager = NULL; g_object_get (G_OBJECT (shell), "removable-media-manager", &rmm, "ui-manager", &uimanager, NULL); gtk_ui_manager_remove_ui (uimanager, plugin->ui_merge_id); gtk_ui_manager_remove_action_group (uimanager, plugin->action_group); g_signal_handlers_disconnect_by_func (G_OBJECT (rmm), create_source_cb, plugin); g_list_foreach (plugin->ipod_sources, (GFunc)rb_source_delete_thyself, NULL); g_list_free (plugin->ipod_sources); plugin->ipod_sources = NULL; g_object_unref (G_OBJECT (uimanager)); g_object_unref (G_OBJECT (rmm)); }
static void impl_activate (PeasActivatable *bplugin) { RBIpodPlugin *plugin = RB_IPOD_PLUGIN (bplugin); RBRemovableMediaManager *rmm = NULL; GtkUIManager *uimanager = NULL; RBShell *shell; gboolean scanned; char *file; g_object_get (plugin, "object", &shell, NULL); g_object_get (G_OBJECT (shell), "removable-media-manager", &rmm, "ui-manager", &uimanager, NULL); rb_media_player_source_init_actions (shell); /* add ipod UI */ plugin->action_group = gtk_action_group_new ("iPodActions"); gtk_action_group_set_translation_domain (plugin->action_group, GETTEXT_PACKAGE); _rb_action_group_add_display_page_actions (plugin->action_group, G_OBJECT (shell), rb_ipod_plugin_actions, G_N_ELEMENTS (rb_ipod_plugin_actions)); gtk_ui_manager_insert_action_group (uimanager, plugin->action_group, 0); file = rb_find_plugin_data_file (G_OBJECT (bplugin), "ipod-ui.xml"); plugin->ui_merge_id = gtk_ui_manager_add_ui_from_file (uimanager, file, NULL); g_free (file); /* watch for new removable media, and cause a rescan */ g_signal_connect (G_OBJECT (rmm), "create-source-mount", G_CALLBACK (create_source_cb), plugin); /* only scan if we're being loaded after the initial scan has been done */ g_object_get (G_OBJECT (rmm), "scanned", &scanned, NULL); if (scanned) rb_removable_media_manager_scan (rmm); g_object_unref (rmm); g_object_unref (uimanager); g_object_unref (shell); }