Esempio n. 1
0
static gboolean activate_plugin(AnjutaPlugin *plugin) {
    AnjutaUI *ui;
    GtkActionGroup* action_group;

    /* Prepare the icons for the playlist */
    register_icon_path(get_plugin_dir(), "sjcd");
    register_stock_icon(PREFERENCE_ICON, PREFERENCE_ICON_STOCK_ID);

    sjcd_plugin = (SJCDPlugin*) plugin;
    ui = anjuta_shell_get_ui(plugin->shell, NULL);

    /* Add actions */
    action_group
            = anjuta_ui_add_action_group_entries(ui, "ActionGroupSjCd", _("Sound Juicer"), sjcd_actions, G_N_ELEMENTS (sjcd_actions), GETTEXT_PACKAGE, TRUE, plugin);
    sjcd_plugin->action_group = action_group;

    /* Merge UI */
    gchar *uipath = g_build_filename(get_ui_dir(), "sjcd.ui", NULL);
    sjcd_plugin->uiid = anjuta_ui_merge(ui, uipath);
    g_free(uipath);

    sjcd_plugin->sj_view = sj_create_sound_juicer();
    gtk_widget_show_all(sjcd_plugin->sj_view);
    // Add widget directly as scrolling is handled internally by the widget
    anjuta_shell_add_widget(plugin->shell, sjcd_plugin->sj_view, "SJCDPlugin", _("  Sound Juicer"), NULL, ANJUTA_SHELL_PLACEMENT_TOP, NULL);


    return TRUE; /* FALSE if activation failed */
}
Esempio n. 2
0
static void
on_value_removed (AnjutaPlugin *plugin,
				  const gchar *name,
				  gpointer data)
{
	AnjutaShell* shell = anjuta_plugin_get_shell (plugin);
	StarterPlugin* splugin = ANJUTA_PLUGIN_STARTER (plugin);
	IAnjutaDocumentManager* docman = anjuta_shell_get_interface (shell,
																 IAnjutaDocumentManager,
																 NULL);
	IAnjutaProjectManager* pm = anjuta_shell_get_interface (shell,
															IAnjutaProjectManager,
															NULL);
	
	if (!(docman && ianjuta_document_manager_get_doc_widgets (docman, NULL)) &&
		!(pm && ianjuta_project_manager_get_current_project (pm, NULL)))
	{
		DEBUG_PRINT ("Showing starter");
		splugin->priv->starter = create_starter_widget (splugin);
		anjuta_shell_add_widget (shell, splugin->priv->starter,
								 "AnjutaStarter",
								 _("Start"),
								 GTK_STOCK_ABOUT,
								 ANJUTA_SHELL_PLACEMENT_CENTER,
								 NULL);
		anjuta_shell_present_widget (shell, splugin->priv->starter, NULL);
		g_object_unref (splugin->priv->starter);
	}
}
Esempio n. 3
0
static gboolean activate_plugin(AnjutaPlugin *plugin) {
    AnjutaUI *ui;
    PlaylistDisplayPlugin *playlist_display_plugin;
    GtkActionGroup* action_group;
    GtkAction *new_playlist_action;
    GtkAction *load_ipods_action;

    /* Set preferences */
    set_default_preferences();

    /* Prepare the icons for the playlist */
    register_icon_path(get_plugin_dir(), "playlist_display");
    register_stock_icon(PREFERENCE_ICON, PREFERENCE_ICON_STOCK_ID);

    register_stock_icon("playlist_display-photo", PLAYLIST_DISPLAY_PHOTO_ICON_STOCK_ID);
    register_stock_icon("playlist_display-playlist", PLAYLIST_DISPLAY_PLAYLIST_ICON_STOCK_ID);
    register_stock_icon("playlist_display-read", PLAYLIST_DISPLAY_READ_ICON_STOCK_ID);
    register_stock_icon("playlist_display-add-dirs", PLAYLIST_DISPLAY_ADD_DIRS_ICON_STOCK_ID);
    register_stock_icon("playlist_display-add-files", PLAYLIST_DISPLAY_ADD_FILES_ICON_STOCK_ID);
    register_stock_icon("playlist_display-add-playlists", PLAYLIST_DISPLAY_ADD_PLAYLISTS_ICON_STOCK_ID);
    register_stock_icon("playlist_display-sync", PLAYLIST_DISPLAY_SYNC_ICON_STOCK_ID);

    playlist_display_plugin = (PlaylistDisplayPlugin*) plugin;
    ui = anjuta_shell_get_ui(plugin->shell, NULL);

    /* Add our playlist_actions */
    action_group
        = anjuta_ui_add_action_group_entries(ui, "ActionGroupPlaylistDisplay", _("Playlist Display"), playlist_actions, G_N_ELEMENTS (playlist_actions), GETTEXT_PACKAGE, TRUE, plugin);
    playlist_display_plugin->action_group = action_group;

    new_playlist_action = tool_menu_action_new (ACTION_NEW_PLAYLIST, _("New Playlist"), _("Create a new playlist for the selected iPod"), GTK_STOCK_NEW);
    g_signal_connect(new_playlist_action, "activate", G_CALLBACK(on_new_playlist_activate), NULL);
    gtk_action_group_add_action (playlist_display_plugin->action_group, GTK_ACTION (new_playlist_action));

    load_ipods_action = tool_menu_action_new (ACTION_DISPLAY_LOAD_IPODS, _("Load iPods"), _("Load all or selected iPods"), PLAYLIST_DISPLAY_READ_ICON_STOCK_ID);
    g_signal_connect(load_ipods_action, "activate", G_CALLBACK(on_load_ipods_mi), NULL);
    gtk_action_group_add_action (playlist_display_plugin->action_group, GTK_ACTION (load_ipods_action));

    /* Merge UI */
    gchar *uipath = g_build_filename(get_ui_dir(), "playlist_display.ui", NULL);
    playlist_display_plugin->uiid = anjuta_ui_merge(ui, uipath);
    g_free(uipath);

    playlist_display_plugin->playlist_view = pm_create_playlist_view(action_group);

    g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_ADDED, G_CALLBACK (playlist_display_playlist_added_cb), NULL);
    g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_REMOVED, G_CALLBACK (playlist_display_playlist_removed_cb), NULL);
    g_signal_connect (gtkpod_app, SIGNAL_ITDB_ADDED, G_CALLBACK (playlist_display_itdb_added_cb), NULL);
    g_signal_connect (gtkpod_app, SIGNAL_ITDB_REMOVED, G_CALLBACK (playlist_display_itdb_removed_cb), NULL);
    g_signal_connect (gtkpod_app, SIGNAL_ITDB_UPDATED, G_CALLBACK (playlist_display_update_itdb_cb), NULL);
    g_signal_connect (gtkpod_app, SIGNAL_PREFERENCE_CHANGE, G_CALLBACK (playlist_display_preference_changed_cb), NULL);
    g_signal_connect (gtkpod_app, SIGNAL_ITDB_DATA_CHANGED, G_CALLBACK (playlist_display_itdb_data_changed_cb), NULL);
    g_signal_connect (gtkpod_app, SIGNAL_ITDB_DATA_SAVED, G_CALLBACK (playlist_display_itdb_data_changed_cb), NULL);

    gtk_widget_show_all(playlist_display_plugin->playlist_view);
    // Add widget directly as scrolling is handled internally by the widget
    anjuta_shell_add_widget(plugin->shell, playlist_display_plugin->playlist_view, "PlaylistDisplayPlugin", _("  iPod Repositories"), PLAYLIST_DISPLAY_PLAYLIST_ICON_STOCK_ID, ANJUTA_SHELL_PLACEMENT_LEFT, NULL);

    return TRUE; /* FALSE if activation failed */
}
Esempio n. 4
0
static gboolean
create_disassemble_gui (DmaDisassemble *self)
{
	GtkWidget *dataview;

	g_return_val_if_fail (self->buffer == NULL, FALSE);
	g_return_val_if_fail (self->window == NULL, FALSE);
	
	/* Create buffer */
	self->buffer = DMA_SPARSE_BUFFER (dma_disassembly_buffer_new (self->debugger, 0x00000000U,0xFFFFFFFFU));
	if (self->buffer == NULL) return FALSE;		
	
	dataview = GTK_WIDGET (dma_disassembly_view_new_with_buffer (self->debugger, self->buffer));
	self->view = DMA_SPARSE_VIEW (dataview);
	DMA_DISASSEMBLY_VIEW (dataview)->pending = FALSE;
	g_signal_connect (G_OBJECT (self->buffer), "changed", G_CALLBACK (on_disassembly_buffer_changed), self->view);

	/* Add disassembly window */
	self->window = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->window),
									GTK_POLICY_AUTOMATIC,
									GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (self->window),
									 GTK_SHADOW_IN);
	gtk_container_add (GTK_CONTAINER (self->window), GTK_WIDGET (dataview));
	
	anjuta_shell_add_widget (ANJUTA_PLUGIN (self->plugin)->shell,
							 self->window,
                             "AnjutaDebuggerDisassemble", _("Disassembly"),
                             "debugger-disassembly", ANJUTA_SHELL_PLACEMENT_NONE,
							 NULL);

	return TRUE;
}
Esempio n. 5
0
static gboolean
activate_plugin (AnjutaPlugin *plugin)
{
	TerminalPlugin *term_plugin;
	static gboolean initialized = FALSE;
	AnjutaUI *ui;
	
	DEBUG_PRINT ("%s", "TerminalPlugin: Activating Terminal plugin ...");
	
	term_plugin = ANJUTA_PLUGIN_TERMINAL (plugin);
	term_plugin->widget_added_to_shell = FALSE;
	ui = anjuta_shell_get_ui (plugin->shell, NULL);
	term_plugin->action_group = anjuta_ui_add_action_group_entries (ui,
										"ActionGroupTerminal",
										_("terminal operations"),
										actions_terminal,
										G_N_ELEMENTS (actions_terminal),
										GETTEXT_PACKAGE, TRUE, term_plugin);
	term_plugin->uiid = anjuta_ui_merge (ui, UI_FILE);
	
	terminal_create (term_plugin);
	
	if (!initialized)
	{
		register_stock_icons (plugin);
	}
	
	/* Setup prefs callbacks */
	prefs_init (term_plugin);
	
	/* Added widget in shell */
	anjuta_shell_add_widget (plugin->shell, term_plugin->frame,
							 "AnjutaTerminal", _("Terminal"),
							 "terminal-plugin-icon",
							 ANJUTA_SHELL_PLACEMENT_BOTTOM, NULL);
	/* terminal_focus_cb (term_plugin->term, NULL, term_plugin); */
	term_plugin->widget_added_to_shell = TRUE;
	initialized = TRUE;

	/* Set all terminal preferences, at that time the terminal widget is
	 * not realized, a few vte functions are not working. Another
	 * possibility could be to call this when the widget is realized */
	preferences_changed (term_plugin->settings, term_plugin);
	
	/* set up project directory watch */
	term_plugin->root_watch_id = anjuta_plugin_add_watch (plugin,
														  IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
														  on_project_root_added,
														  0, NULL);
	
	return TRUE;
}
Esempio n. 6
0
static gboolean
file_manager_activate (AnjutaPlugin *plugin)
{
	AnjutaUI *ui;
	AnjutaFileManager *file_manager;
	
	DEBUG_PRINT ("%s", "AnjutaFileManager: Activating AnjutaFileManager plugin ...");
	file_manager = (AnjutaFileManager*) plugin;
	
	/* Add all UI actions and merge UI */
	ui = anjuta_shell_get_ui (plugin->shell, NULL);
	
	/* Add action group */
	file_manager->action_group = 
		anjuta_ui_add_action_group_entries (ui, "ActionGroupFileManager",
											_("File manager popup actions"),
											popup_actions, 1,
											GETTEXT_PACKAGE, FALSE,
											plugin);
	
	file_manager->uiid = anjuta_ui_merge (ui, UI_FILE);
	
	file_manager->sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (file_manager->sw),
								    GTK_POLICY_AUTOMATIC,
								    GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (file_manager->sw),
										 GTK_SHADOW_IN);
	
	file_manager->fv = ANJUTA_FILE_VIEW (file_view_new ());
	
	g_signal_connect (G_OBJECT (file_manager->fv), "file-open",
					  G_CALLBACK (on_file_view_open_file), file_manager);
	g_signal_connect (G_OBJECT(file_manager->fv), "show-popup-menu",
					  G_CALLBACK (on_file_view_show_popup_menu), file_manager);
	g_signal_connect (G_OBJECT(file_manager->fv), "current-file-changed",
					  G_CALLBACK (on_file_view_current_file_changed),
					  file_manager);
	file_manager_set_default_uri (file_manager);
	file_view_refresh (file_manager->fv);
	
	gtk_container_add (GTK_CONTAINER (file_manager->sw), 
					   GTK_WIDGET (file_manager->fv));
	
	gtk_widget_show_all (file_manager->sw);
	
	anjuta_shell_add_widget (plugin->shell, file_manager->sw,
							 "AnjutaFileManager",
							 _("Files"), GTK_STOCK_OPEN,
							 ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
	
	file_manager->root_watch_id =
		anjuta_plugin_add_watch (plugin, IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI,
								 project_root_added,
								 project_root_removed, NULL);
	

	g_signal_connect (file_manager->settings, "changed::" PREF_ROOT, 
	                  G_CALLBACK (on_notify_root), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_BINARY, 
	                  G_CALLBACK (on_notify), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_HIDDEN, 
	                  G_CALLBACK (on_notify), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_BACKUP, 
	                  G_CALLBACK (on_notify), file_manager);
	g_signal_connect (file_manager->settings, "changed::" PREF_FILTER_UNVERSIONED, 
	                  G_CALLBACK (on_notify), file_manager);
	on_notify (file_manager->settings, NULL, file_manager);
	
	return TRUE;
}
static gboolean
snippets_manager_activate (AnjutaPlugin * plugin)
{
    SnippetsManagerPlugin *snippets_manager_plugin = ANJUTA_PLUGIN_SNIPPETS_MANAGER (plugin);
    AnjutaUI *anjuta_ui = NULL;

    /* Assertions */
    g_return_val_if_fail (ANJUTA_IS_PLUGIN_SNIPPETS_MANAGER (snippets_manager_plugin),
                          FALSE);

    /* Link the AnjutaShell to the SnippetsDB and load the SnippetsDB*/
    snippets_manager_plugin->snippets_db->anjuta_shell = plugin->shell;
    snippets_db_load (snippets_manager_plugin->snippets_db);

    /* Link the AnjutaShell to the SnippetsProvider and load if necessary */
    snippets_manager_plugin->snippets_provider->anjuta_shell = plugin->shell;

    /* Load the SnippetsBrowser with the snippets in the SnippetsDB */
    snippets_manager_plugin->snippets_browser->anjuta_shell = plugin->shell;
    snippets_browser_load (snippets_manager_plugin->snippets_browser,
                           snippets_manager_plugin->snippets_db,
                           snippets_manager_plugin->snippets_interaction);
    anjuta_shell_add_widget (plugin->shell,
                             GTK_WIDGET (snippets_manager_plugin->snippets_browser),
                             "snippets_browser",
                             _("Snippets"),
                             GTK_STOCK_FILE,
                             ANJUTA_SHELL_PLACEMENT_LEFT,
                             NULL);
    snippets_manager_plugin->browser_maximized = FALSE;

    /* Initialize the Interaction Interpreter */
    snippets_interaction_start (snippets_manager_plugin->snippets_interaction,
                                plugin->shell);

    /* Add a watch for the current document */
    snippets_manager_plugin->cur_editor_watch_id =
        anjuta_plugin_add_watch (plugin,
                                 IANJUTA_DOCUMENT_MANAGER_CURRENT_DOCUMENT,
                                 on_added_current_document,
                                 on_removed_current_document,
                                 NULL);

    /* Merge the Menu UI */
    anjuta_ui = anjuta_shell_get_ui (plugin->shell, FALSE);

    snippets_manager_plugin->action_group =
        anjuta_ui_add_action_group_entries (anjuta_ui,
                                            "ActionGroupSnippetsManager",
                                            _("Snippets Manager actions"),
                                            actions_snippets,
                                            G_N_ELEMENTS (actions_snippets),
                                            GETTEXT_PACKAGE,
                                            TRUE,
                                            snippets_manager_plugin);

    snippets_manager_plugin->uiid = anjuta_ui_merge (anjuta_ui, MENU_UI);

    DEBUG_PRINT ("%s", "SnippetsManager: Activating SnippetsManager plugin …");

    return TRUE;
}