static void npw_druid_set_busy (NPWDruid *druid, gboolean busy_state) { if (druid->busy == busy_state) return; /* Set busy state */ if (busy_state) anjuta_status_busy_push (anjuta_shell_get_status (ANJUTA_PLUGIN (druid->plugin)->shell, NULL)); else anjuta_status_busy_pop (anjuta_shell_get_status (ANJUTA_PLUGIN (druid->plugin)->shell, NULL)); druid->busy = busy_state; }
static void on_create_command_finished (AnjutaCommand *command, guint return_code, Git *plugin) { AnjutaStatus *status; gchar *branch_name; gchar *status_message; if (return_code == 0) { status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL); branch_name = git_branch_create_command_get_branch_name (GIT_BRANCH_CREATE_COMMAND (command)); status_message = g_strdup_printf (_("Git: Created branch \"%s\"."), branch_name); anjuta_status (status, status_message, 5); g_free (branch_name); g_free (status_message); } git_report_errors (command, return_code); g_object_unref (command); }
static void insert_member_decl_and_init (IAnjutaEditor* editor, gchar* widget_name, gchar* ui_filename, CppJavaPlugin* lang_plugin) { AnjutaStatus* status; gchar* member_decl = generate_widget_member_decl_str(widget_name); gchar* member_init = generate_widget_member_init_str(widget_name); gchar* member_decl_marker = generate_widget_member_decl_marker (ui_filename); gchar* member_init_marker = generate_widget_member_init_marker (ui_filename); status = anjuta_shell_get_status (ANJUTA_PLUGIN (lang_plugin)->shell, NULL); if (!glade_widget_already_in_scope (editor, widget_name, member_decl_marker, lang_plugin)) { ianjuta_document_begin_undo_action (IANJUTA_DOCUMENT(editor), NULL); if (insert_after_mark (editor, member_decl_marker, member_decl, lang_plugin)) { insert_after_mark (editor, member_init_marker, member_init, lang_plugin); g_signal_emit_by_name (G_OBJECT (editor), "code-changed", NULL, NULL); anjuta_status_set (status, _("Code added for widget.")); } ianjuta_document_end_undo_action (IANJUTA_DOCUMENT(editor), NULL); } g_free (member_decl); g_free (member_init); g_free (member_decl_marker); g_free (member_init_marker); }
GtkWidget* search_box_new (AnjutaDocman *docman) { SearchBox* search_box; AnjutaUI *ui; search_box = SEARCH_BOX (g_object_new (SEARCH_TYPE_BOX, "homogeneous", FALSE, NULL)); g_signal_connect (G_OBJECT (docman), "document-changed", G_CALLBACK (on_document_changed), search_box); search_box->priv->status = anjuta_shell_get_status (docman->shell, NULL); ui = anjuta_shell_get_ui (docman->shell, NULL); search_box->priv->popup_menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui), "/SearchboxPopup"); g_assert (search_box->priv->popup_menu != NULL && GTK_IS_MENU (search_box->priv->popup_menu)); search_box->priv->case_action = gtk_ui_manager_get_action (GTK_UI_MANAGER (ui), "/SearchboxPopup/CaseCheck"); search_box->priv->highlight_action = gtk_ui_manager_get_action (GTK_UI_MANAGER (ui), "/SearchboxPopup/HighlightAll"); search_box->priv->regex_action = gtk_ui_manager_get_action (GTK_UI_MANAGER (ui), "/SearchboxPopup/RegexSearch"); g_signal_connect (search_box->priv->popup_menu, "deactivate", G_CALLBACK (gtk_widget_hide), NULL); return GTK_WIDGET (search_box); }
guint status_bar_progress_pulse (Subversion *plugin, gchar *text) { PulseProgressData *data; data = g_new0 (PulseProgressData, 1); data->status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL); data->text = g_strdup (text); return g_timeout_add_full (G_PRIORITY_DEFAULT, 100, (GSourceFunc) status_pulse_timer, data, (GDestroyNotify) on_pulse_timer_destroyed); }
static void on_commit_command_finished (AnjutaCommand *command, guint return_code, Subversion *plugin) { AnjutaStatus *status; status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL); anjuta_status (status, _("Subversion: Commit complete."), 5); report_errors (command, return_code); svn_commit_command_destroy (SVN_COMMIT_COMMAND (command)); }
static void on_pull_command_finished (AnjutaCommand *command, guint return_code, Git *plugin) { AnjutaStatus *status; status = anjuta_shell_get_status (ANJUTA_PLUGIN (plugin)->shell, NULL); anjuta_status (status, _("Git: Pull complete."), 5); git_report_errors (command, return_code); g_object_unref (command); }
AnjutaPluginManager *plugin_manager; AnjutaProfileManager *profile_manager; AnjutaApp *app; AnjutaStatus *status; AnjutaProfile *profile; GFile *session_profile; gchar *remembered_plugins; GFile *project = NULL; GFile *template = NULL; gchar *profile_name = NULL; gchar *im_file = NULL; GError *error = NULL; /* Initialize application */ app = ANJUTA_APP (anjuta_app_new ()); status = anjuta_shell_get_status (ANJUTA_SHELL (app), NULL); anjuta_status_progress_add_ticks (status, 1); im_file = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_SPLASH_SCREEN); gtk_window_set_role (GTK_WINDOW (app), "anjuta-app"); gtk_window_set_auto_startup_notification(TRUE); gtk_window_set_default_icon_name ("anjuta"); gtk_window_set_auto_startup_notification(FALSE); if (im_file) { anjuta_status_set_splash (status, im_file, 100); g_free (im_file); } if (no_splash)
void gtkpod_init(int argc, char *argv[]) { AnjutaPluginManager *plugin_manager; AnjutaProfileManager *profile_manager; AnjutaApp *app; AnjutaStatus *status; AnjutaProfile *profile; GFile *session_profile; GError *error = NULL; gchar *default_profile_file = NULL; gchar *user_profile_file = NULL; gchar *ui_file = NULL; gchar *remembered_plugins = NULL; gchar *session_dir = NULL; gchar *splash = NULL; /* Initialise important directories */ init_directories(argv); register_stock_icon(GTKPOD_ICON, GTKPOD_ICON_STOCK_ID); /* Initialise the ui file */ ui_file = g_build_filename(get_ui_dir(), "gtkpod.ui", NULL); anjuta_set_ui_file_path(ui_file); /* Register the application icon */ register_stock_icon("gtkpod", GTKPOD_APP_ICON_STOCK_ID); /* Initialize application class instance*/ app = ANJUTA_APP(anjuta_app_new()); gtkpod_app = GTKPOD_APP(app); /* Initialise the preferences as required for the display of the splash screen */ prefs_init(argc, argv); /* Show some progress as the app is initialised */ status = anjuta_shell_get_status(ANJUTA_SHELL(app), NULL); anjuta_status_progress_add_ticks(status, 1); /* Show the splash screen if user requires */ if (! prefs_get_int(DISABLE_SPLASH_SCREEN)) { splash = g_build_filename(get_icon_dir(), "gtkpod-splash.png", NULL); if (g_file_test(splash, G_FILE_TEST_IS_REGULAR)) anjuta_status_set_splash(status, splash, 100); else { anjuta_status_disable_splash(status, TRUE); } g_free(splash); } /* * initialise gtkpod library items. Needs to be safety threaded due * to splash screen. */ gdk_threads_enter(); gp_init(argc, argv); gdk_threads_leave(); /* Add blocking widgets from the framework */ add_blocked_widget(app->toolbar); add_blocked_widget(app->view_menu); /* Set up shutdown signals */ g_signal_connect(G_OBJECT(app), "delete_event", G_CALLBACK( on_gtkpod_delete_event), NULL); g_signal_connect(G_OBJECT(app), "destroy", G_CALLBACK(on_gtkpod_destroy), NULL); plugin_manager = anjuta_shell_get_plugin_manager(ANJUTA_SHELL(app), NULL); profile_manager = anjuta_shell_get_profile_manager(ANJUTA_SHELL(app), NULL); /* Restore remembered plugins */ remembered_plugins = g_settings_get_string(app->settings, GTKPOD_REMEMBERED_PLUGINS); if (remembered_plugins) anjuta_plugin_manager_set_remembered_plugins(plugin_manager, remembered_plugins); g_free(remembered_plugins); /* Load default profile */ default_profile_file = get_default_profile_path(); profile = anjuta_profile_new(USER_PROFILE_NAME, plugin_manager); session_profile = g_file_new_for_path(default_profile_file); anjuta_profile_add_plugins_from_xml(profile, session_profile, TRUE, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } g_object_unref(session_profile); g_free(default_profile_file); /* Load user session profile */ user_profile_file = get_user_profile_path(); session_profile = g_file_new_for_path(user_profile_file); if (g_file_query_exists(session_profile, NULL)) { anjuta_profile_add_plugins_from_xml(profile, session_profile, FALSE, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } } anjuta_profile_set_sync_file(profile, session_profile); g_object_unref(session_profile); g_free(user_profile_file); /* Load profile */ anjuta_profile_manager_freeze(profile_manager); anjuta_profile_manager_push(profile_manager, profile, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } /* Prepare for session save and load on profile change */ g_signal_connect (profile_manager, "profile-scoped", G_CALLBACK (on_profile_scoped), app); anjuta_profile_manager_thaw(profile_manager, &error); if (error) { anjuta_util_dialog_error(GTK_WINDOW(app), "%s", error->message); g_error_free(error); error = NULL; } g_signal_connect (profile_manager, "profile-descoped", G_CALLBACK (on_profile_descoped), app); gdk_threads_enter(); gp_init_itdbs(); gdk_threads_leave(); /* Load layout.*/ session_dir = get_user_session_dir(); if (!g_file_test(session_dir, G_FILE_TEST_IS_DIR)) session_dir = g_strdup(get_data_dir()); /* Restore session */ anjuta_shell_session_load(ANJUTA_SHELL(app), session_dir, NULL); g_free(session_dir); anjuta_status_progress_tick(status, NULL, _("Loaded Session...")); anjuta_status_disable_splash(status, TRUE); gtk_window_set_default_icon_name("gtkpod"); gtk_window_set_auto_startup_notification(TRUE); gtk_window_set_role(GTK_WINDOW(app), "gtkpod-app"); gtk_widget_show(GTK_WIDGET(app)); }
static GtkWidget* npw_druid_create_assistant (NPWDruid* druid, GFile *templates) { AnjutaShell *shell; GtkBuilder *builder; GError* error = NULL; GtkAssistant *assistant; GtkWidget *property_page; g_return_val_if_fail (druid->window == NULL, NULL); shell = ANJUTA_PLUGIN (druid->plugin)->shell; /* Create GtkAssistant using GtkBuilder, glade doesn't seem to work*/ builder = gtk_builder_new (); if (!gtk_builder_add_from_file (builder, GTK_BUILDER_UI_FILE, &error)) { g_warning ("Couldn't load builder file: %s", error->message); g_error_free (error); return NULL; } anjuta_util_builder_get_objects (builder, NEW_PROJECT_DIALOG, &assistant, PROJECT_BOOK, &druid->project_book, ERROR_VBOX, &druid->error_vbox, ERROR_TITLE, &druid->error_title, ERROR_ICON, &druid->error_icon, ERROR_MESSAGE, &druid->error_message, ERROR_DETAIL, &druid->error_detail, PROJECT_PAGE, &druid->project_page, ERROR_PAGE, &druid->error_page, PROGRESS_PAGE, &druid->progress_page, FINISH_PAGE, &druid->finish_page, FINISH_TEXT, &druid->finish_text, PROPERTY_PAGE, &property_page, NULL); druid->window = GTK_WINDOW (assistant); gtk_window_set_transient_for (GTK_WINDOW (assistant), GTK_WINDOW (shell)); g_object_unref (builder); /* Connect assistant signals */ g_signal_connect (G_OBJECT (assistant), "prepare", G_CALLBACK (on_druid_prepare), druid); g_signal_connect (G_OBJECT (assistant), "apply", G_CALLBACK (on_druid_finish), druid); g_signal_connect (G_OBJECT (assistant), "cancel", G_CALLBACK (on_druid_cancel), druid); g_signal_connect (G_OBJECT (assistant), "close", G_CALLBACK (on_druid_close), druid); g_signal_connect(G_OBJECT(assistant), "key-press-event", G_CALLBACK(on_project_wizard_key_press_event), druid); /* Remove property page, will be created later as needed */ gtk_container_remove (GTK_CONTAINER (assistant), property_page); /* Remove error page, could be needed later so keep a ref */ g_object_ref (druid->error_page); gtk_container_remove (GTK_CONTAINER (assistant), druid->error_page); /* Remove progress page, could be needed later so keep a ref */ g_object_ref (druid->progress_page); gtk_container_remove (GTK_CONTAINER (assistant), druid->progress_page); /* Setup project selection page */ if (!npw_druid_fill_selection_page (druid, templates)) { return NULL; } /* Add dialog widget to anjuta status. */ anjuta_status_add_widget (anjuta_shell_get_status (shell, NULL), GTK_WIDGET (assistant)); gtk_window_set_default_size (GTK_WINDOW (assistant), 600, 500); gtk_widget_show_all (GTK_WIDGET (assistant)); return GTK_WIDGET(assistant); }