static gboolean activate_plugin(AnjutaPlugin *plugin) { AnjutaUI *ui; GtkActionGroup* action_group; photo_editor_plugin = (PhotoEditorPlugin*) plugin; register_icon_path(get_plugin_dir(), "photo_editor"); register_stock_icon(DEFAULT_PHOTO_EDITOR_ICON, DEFAULT_PHOTO_EDITOR_STOCK_ID); register_stock_icon(PHOTO_TOOLBAR_ALBUM_ICON, PHOTO_TOOLBAR_ALBUM_STOCK_ID); register_stock_icon(PHOTO_TOOLBAR_PHOTOS_ICON, PHOTO_TOOLBAR_PHOTOS_STOCK_ID); ui = anjuta_shell_get_ui(plugin->shell, NULL); /* Add our playlist_actions */ action_group = anjuta_ui_add_action_group_entries(ui, "ActionGroupPhotoEditor", _("Photo Editor"), photo_editor_actions, G_N_ELEMENTS (photo_editor_actions), GETTEXT_PACKAGE, TRUE, plugin); photo_editor_plugin->action_group = action_group; /* Merge UI */ gchar *uipath = g_build_filename(get_ui_dir(), "photo_editor.ui", NULL); photo_editor_plugin->uiid = anjuta_ui_merge(ui, uipath); g_free(uipath); g_return_val_if_fail(PHOTO_EDITOR_IS_EDITOR(photo_editor_plugin), TRUE); gtkpod_register_photo_editor (PHOTO_EDITOR(photo_editor_plugin)); g_signal_connect (gtkpod_app, SIGNAL_PLAYLIST_SELECTED, G_CALLBACK (photo_editor_select_playlist_cb), NULL); return TRUE; /* FALSE if activation failed */ }
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 */ }
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 */ }
void ar_stock_init (void) { /* These stocks have a gtk stock icon */ const char *stock_icon_aliases[][2] = { { AR_STOCK_CONTENTS, "help-contents" }, { AR_STOCK_HINT, "dialog-information" }, { AR_STOCK_NEW_GAME, "document-new" }, { AR_STOCK_START_NEW_GAME, "document-new" }, { AR_STOCK_RESET, "edit-clear" }, { AR_STOCK_RESTART_GAME, "view-refresh" }, { AR_STOCK_FULLSCREEN, "view-fullscreen" }, { AR_STOCK_LEAVE_FULLSCREEN, "view-restore" }, { AR_STOCK_PAUSE_GAME, "media-playback-pause" }, }; #ifndef HAVE_GTK_ICON_FACTORY_ADD_ALIAS const char *stock_icon_aliases_bidi[][3] = { { AR_STOCK_REDO_MOVE, "edit-redo", "edit-undo" }, { AR_STOCK_UNDO_MOVE, "edit-undo", "edit-redo" }, }; #endif /* Private icon names */ const char *private_icon_names[][2] = { { AR_STOCK_DEAL_CARDS, "cards-deal" } }; static const GtkStockItem ar_stock_items[] = { { AR_STOCK_CONTENTS, N_("_Contents"), 0, GDK_KEY_F1, NULL }, { AR_STOCK_FULLSCREEN, N_("_Fullscreen"), 0, GDK_KEY_F11, NULL }, { AR_STOCK_HINT, N_("_Hint"), GDK_CONTROL_MASK, 'h', NULL }, /* Translators: This "_New" is for the menu item 'Game->New', implies "New Game" */ { AR_STOCK_NEW_GAME, N_("_New"), GDK_CONTROL_MASK, 'n', NULL }, /* Translators: This "_New Game" is for the game-over dialogue */ { AR_STOCK_START_NEW_GAME, N_("_New Game"), 0, 0, NULL }, { AR_STOCK_REDO_MOVE, N_("_Redo Move"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, 'z', NULL }, /* Translators: this is the "Reset" scores button in a scores dialogue */ { AR_STOCK_RESET, N_("_Reset"), 0, 0, NULL }, /* Translators: "_Restart" is the menu item 'Game->Restart', implies "Restart Game" */ { AR_STOCK_RESTART_GAME, N_("_Restart"), 0, 0, NULL }, { AR_STOCK_UNDO_MOVE, N_("_Undo Move"), GDK_CONTROL_MASK, 'z', NULL }, { AR_STOCK_DEAL_CARDS, N_("_Deal"), GDK_CONTROL_MASK, 'd', NULL }, { AR_STOCK_LEAVE_FULLSCREEN, N_("_Leave Fullscreen"), 0, GDK_KEY_F11, NULL }, { AR_STOCK_PAUSE_GAME, N_("_Pause"), 0, GDK_KEY_Pause, NULL }, }; guint i; GtkIconFactory *icon_factory; icon_factory = gtk_icon_factory_new (); #ifdef HAVE_GTK_ICON_FACTORY_ADD_ALIAS for (i = 0; i < G_N_ELEMENTS (stock_icon_aliases); ++i) { gtk_icon_factory_add_alias (stock_icon_aliases[i][0], stock_icon_aliases[i][1]); } #else for (i = 0; i < G_N_ELEMENTS (stock_icon_aliases); ++i) { register_stock_icon (icon_factory, stock_icon_aliases[i][0], stock_icon_aliases[i][1]); } for (i = 0; i < G_N_ELEMENTS (stock_icon_aliases_bidi); ++i) { register_stock_icon_bidi (icon_factory, stock_icon_aliases_bidi[i][0], stock_icon_aliases_bidi[i][1], stock_icon_aliases_bidi[i][2]); } #endif /* HAVE_GTK_ICON_FACTORY_ADD_ALIAS */ /* Register our private themeable icons */ for (i = 0; i < G_N_ELEMENTS (private_icon_names); i++) { register_stock_icon (icon_factory, private_icon_names[i][0], private_icon_names[i][1]); } gtk_icon_factory_add_default (icon_factory); g_object_unref (icon_factory); /* GtkIconTheme will then look in our custom hicolor dir * for icons as well as the standard search paths. */ /* FIXME: multi-head! */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), ar_runtime_get_directory (AR_RUNTIME_ICON_THEME_DIRECTORY)); gtk_stock_add_static (ar_stock_items, G_N_ELEMENTS (ar_stock_items)); }
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 void abi_table_init (AbiTable* table) { UT_UTF8String prText = "%d x %d "; char* text = g_strdup_printf(prText.utf8_str(), init_rows, init_cols); register_stock_icon(); table->button_box = gtk_vbox_new(FALSE, 0); table->window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP)); table->window_vbox = GTK_VBOX(gtk_vbox_new(FALSE, 0)); table->area = GTK_DRAWING_AREA(gtk_drawing_area_new()); table->handlers = 0; table->window_label = GTK_LABEL(gtk_label_new(text)); g_free(text); table->szTable = NULL; table->szCancel = NULL; gtk_container_add(GTK_CONTAINER(table->window), GTK_WIDGET(table->window_vbox)); gtk_box_pack_end(GTK_BOX(table->window_vbox), GTK_WIDGET(table->window_label), FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(table->window_vbox), GTK_WIDGET(table->area), TRUE, TRUE, 0); gtk_widget_show_all(GTK_WIDGET(table->window_vbox)); table->selected_rows = init_rows; table->selected_cols = init_cols; table->total_rows = my_max(init_rows + 1, 5); table->total_cols = my_max(init_cols + 1, 6); abi_table_resize(table); table->icon = NULL; if (gtk_stock_lookup ("abi-table-widget", &table->stock_item)) { table->label = gtk_label_new_with_mnemonic(table->stock_item.label); table->icon = gtk_image_new_from_stock ("abi-table-widget", GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_widget_show(table->icon); gtk_widget_show(table->label); // // We actually never want this label in toolbar // gtk_box_pack_end(GTK_BOX(table->button_box), table->label, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(table->button_box), table->icon, FALSE, FALSE, 0); UT_DEBUGMSG(("abi-table icon loaded %p !\n",table->icon)); } else { /* it should not happen... */ UT_DEBUGMSG(("abi-table icon did not load !\n")); UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); table->label = gtk_label_new_with_mnemonic("_Table"); // gtk_box_pack_end(GTK_BOX(table->button_box), table->label, FALSE, FALSE, 0); } gtk_container_add(GTK_CONTAINER(table), GTK_WIDGET(table->button_box)); g_signal_connect(G_OBJECT(table), "pressed", G_CALLBACK(on_pressed), static_cast<gpointer>(table)); g_signal_connect(G_OBJECT(table->area), "expose_event", G_CALLBACK(on_drawing_area_event), static_cast<gpointer>(table)); g_signal_connect(G_OBJECT(table->area), "motion_notify_event", G_CALLBACK(on_motion_notify_event), static_cast<gpointer>(table)); g_signal_connect(G_OBJECT(table->area), "button_release_event", G_CALLBACK(on_button_release_event), static_cast<gpointer>(table)); g_signal_connect(G_OBJECT(table->area), "button_press_event", G_CALLBACK(on_button_release_event), static_cast<gpointer>(table)); g_signal_connect(G_OBJECT(table->area), "leave_notify_event", G_CALLBACK(on_leave_event), static_cast<gpointer>(table)); g_signal_connect(G_OBJECT(table->window), "key_press_event", G_CALLBACK(on_key_event), static_cast<gpointer>(table)); gtk_widget_set_events (GTK_WIDGET(table->area), GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); gtk_button_set_relief (GTK_BUTTON (table), GTK_RELIEF_NORMAL); }
/** * gimp_icons_init: * * Initializes the GIMP stock icon factory. * * You don't need to call this function as gimp_ui_init() already does * this for you. */ void gimp_icons_init (void) { static gboolean initialized = FALSE; GtkSettings *settings; GdkPixbuf *pixbuf; GError *error = NULL; gchar *icons_dir; gchar *system_icon_theme; gchar *gimp_icon_theme; gint i; if (initialized) return; gimp_stock_factory = gtk_icon_factory_new (); for (i = 0; i < G_N_ELEMENTS (gimp_stock_items); i++) { register_stock_icon (gimp_stock_factory, gimp_stock_items[i].stock_id, gimp_stock_items[i].stock_id); } register_bidi_stock_icon (gimp_stock_factory, GIMP_STOCK_MENU_LEFT, GIMP_STOCK_MENU_LEFT, GIMP_STOCK_MENU_RIGHT); register_bidi_stock_icon (gimp_stock_factory, GIMP_STOCK_MENU_RIGHT, GIMP_STOCK_MENU_RIGHT, GIMP_STOCK_MENU_LEFT); register_stock_icon (gimp_stock_factory, "gimp-indexed-palette", GIMP_STOCK_COLORMAP); register_stock_icon (gimp_stock_factory, "gimp-qmask-off", GIMP_STOCK_QUICK_MASK_OFF); register_stock_icon (gimp_stock_factory, "gimp-qmask-on", GIMP_STOCK_QUICK_MASK_ON); gtk_icon_factory_add_default (gimp_stock_factory); gtk_stock_add_static (gimp_stock_items, G_N_ELEMENTS (gimp_stock_items)); gtk_stock_add_static (gimp_compat_stock_items, G_N_ELEMENTS (gimp_compat_stock_items)); /* always prepend the default icon theme, it's never removed from * the path again and acts as fallback for missing icons in other * themes. */ if (! default_search_path) default_search_path = gimp_data_directory_file ("icons", NULL); icons_dir = g_file_get_path (default_search_path); gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (), icons_dir); g_free (icons_dir); /* if an icon theme was chosen before init(), change to it */ if (icon_theme_path) { GFile *search_path = g_file_get_parent (icon_theme_path); if (!g_file_equal (search_path, default_search_path)) { gchar *icon_dir = g_file_get_path (search_path); gtk_icon_theme_prepend_search_path (gtk_icon_theme_get_default (), icon_dir); g_free (icon_dir); } g_object_unref (search_path); gimp_icon_theme = g_file_get_basename (icon_theme_path); } else { gimp_icon_theme = g_strdup (GIMP_DEFAULT_ICON_THEME); } settings = gtk_settings_get_for_screen (gdk_screen_get_default ()); g_object_get (settings, "gtk-icon-theme-name", &system_icon_theme, NULL); g_object_set (settings, "gtk-fallback-icon-theme", system_icon_theme, "gtk-icon-theme-name", gimp_icon_theme, NULL); g_free (gimp_icon_theme); g_free (system_icon_theme); g_signal_connect (settings, "notify::gtk-icon-theme-name", G_CALLBACK (gimp_icons_notify_system_icon_theme), NULL); pixbuf = gdk_pixbuf_new_from_resource ("/org/gimp/icons/64/gimp-wilber-eek.png", &error); if (pixbuf) { gtk_icon_theme_add_builtin_icon (GIMP_STOCK_WILBER_EEK, 64, pixbuf); g_object_unref (pixbuf); } else { g_critical ("Failed to create icon image: %s", error->message); g_clear_error (&error); } initialized = TRUE; }