static AsApp * load_desktop (const gchar *prefix, const gchar *icons_dir, guint min_icon_size, const gchar *app_name, const gchar *appdata_id, GError **error) { AsIcon *icon; g_autofree gchar *desktop_basename = NULL; g_autofree gchar *desktop_path = NULL; g_autoptr(AsApp) app = NULL; if (appdata_id != NULL) desktop_basename = g_strdup (appdata_id); else desktop_basename = g_strconcat (app_name, ".desktop", NULL); desktop_path = g_build_filename (prefix, "share/applications", desktop_basename, NULL); app = as_app_new (); if (!as_app_parse_file (app, desktop_path, AS_APP_PARSE_FLAG_USE_HEURISTICS | AS_APP_PARSE_FLAG_ALLOW_VETO, error)) return NULL; if (as_app_get_kind (app) == AS_APP_KIND_UNKNOWN) { g_set_error (error, AS_APP_ERROR, AS_APP_ERROR_FAILED, "%s has no recognised type", as_app_get_id (AS_APP (app))); return NULL; } icon = as_app_get_icon_default (AS_APP (app)); if (icon != NULL) { g_autofree gchar *key = NULL; key = g_strdup (as_icon_get_name (icon)); if (as_icon_get_kind (icon) == AS_ICON_KIND_STOCK) { as_compose_app_log (app, "using stock icon %s", key); } else { g_autoptr(GError) error_local = NULL; gboolean ret; g_ptr_array_set_size (as_app_get_icons (AS_APP (app)), 0); ret = add_icons (app, icons_dir, min_icon_size, prefix, key, error); if (!ret) return NULL; } } return g_steal_pointer (&app); }
void seahorse_gtkstock_init(void) { static gboolean stock_initted = FALSE; if (stock_initted) return; stock_initted = TRUE; gtk_window_set_default_icon_name ("seahorse"); add_icons (seahorse_icons, themed_icons); }
// -------------------------------------------------------------- // object which gives a temporary boost to luck // -------------------------------------------------------------- void t_luck_object::activate_trigger( t_army* army, t_adv_map_point const& point, t_direction direction, t_adventure_frame* frame ) { int i; bool any_award = false; // loop through all heroes/creatures in the army and award temporary statistic based on subtype t_creature_array& creatures = army->get_creatures(); for (i = 0; i < t_creature_array::k_size; i++) { if (creatures[i].get_number() == 0) continue; if (creatures[i].has_temporary_bonus( get_type() )) continue; add_bonus( creatures[i] ); any_award = true; } // determine what response to print if (army->get_owner()->is_computer()) return; t_basic_dialog* dialog; std::string text; dialog = new t_basic_dialog; if (any_award) { text = get_text( "initial" ); add_icons( dialog ); } else { text = get_text( "empty" ); } dialog->set_text( text ); dialog->add_ok_button(); dialog->set_title( get_name() ); dialog->open( get_dialog_bottom( point ), true, k_align_bottom ); t_sound_cache music = get_music_playing(); stop_music(); get_dialog_sound( k_dialog_sound_luck )->play( get_sound_volume() ); dialog->run_modal(); // Update stats. frame->update_army(); play_music( music ); }
void seahorse_gtkstock_add_icons (const gchar **icons) { add_icons (icons, NULL); }