static gboolean virt_viewer_file_check_min_version(VirtViewerFile *self, GError **error) { gchar *min_version = NULL; gint version_cmp; #ifdef REMOTE_VIEWER_OS_ID if (virt_viewer_file_is_set(self, "versions")) { GHashTable *versions; versions = virt_viewer_file_get_versions(self); min_version = g_strdup(g_hash_table_lookup(versions, REMOTE_VIEWER_OS_ID)); g_hash_table_unref(versions); } #endif if (min_version == NULL) { if (virt_viewer_file_is_set(self, "version")) { min_version = virt_viewer_file_get_version(self); } } if (min_version == NULL) { return TRUE; } version_cmp = virt_viewer_compare_buildid(min_version, PACKAGE_VERSION BUILDID); if (version_cmp > 0) { gchar *url; url = virt_viewer_file_get_version_url(self); if (url != NULL) { g_set_error(error, VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED, _("At least %s version %s is required to setup this" " connection, see %s for details"), g_get_application_name(), min_version, url); g_free(url); } else { g_set_error(error, VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED, _("At least %s version %s is required to setup this connection"), g_get_application_name(), min_version); } g_free(min_version); return FALSE; } g_free(min_version); return TRUE; }
/* errstr may be NULL, this might be called before GTK is initialized */ static gboolean lockfile( const char * filename, tr_lockfile_state_t *tr_state, char ** errstr ) { const tr_lockfile_state_t state = tr_lockfile( filename ); const gboolean success = state == TR_LOCKFILE_SUCCESS; if( errstr ) switch( state ) { case TR_LOCKFILE_EOPEN: *errstr = g_strdup_printf( _( "Couldn't open \"%1$s\": %2$s" ), filename, g_strerror( errno ) ); break; case TR_LOCKFILE_ELOCK: *errstr = g_strdup_printf( _( "%s is already running." ), g_get_application_name( ) ); break; case TR_LOCKFILE_SUCCESS: *errstr = NULL; break; } if( tr_state != NULL ) *tr_state = state; return success; }
void RecentManager::addRecentFileUri(const char * uri) { XOJ_CHECK_TYPE(RecentManager); printf("addRecentFileUri: %s\n", uri); GtkRecentManager * recentManager; GtkRecentData * recentData; static gchar * groups[2] = { g_strdup(GROUP), NULL }; recentManager = gtk_recent_manager_get_default(); recentData = g_slice_new(GtkRecentData); recentData->display_name = NULL; recentData->description = NULL; if (g_str_has_suffix(uri, ".pdf")) { recentData->mime_type = (gchar *) g_strdup(MIME_PDF); } else { recentData->mime_type = (gchar *) g_strdup(MIME); } recentData->app_name = (gchar *) g_get_application_name(); recentData->app_exec = g_strjoin(" ", g_get_prgname(), "%u", NULL); recentData->groups = groups; recentData->is_private = FALSE; gtk_recent_manager_add_full(recentManager, uri, recentData); g_free(recentData->app_exec); g_slice_free(GtkRecentData, recentData); }
static void screensaver_inhibit_dbus (ScreenSaver * screensaver, gboolean inhibit) { if (!screensaver->gs_proxy) return; if (inhibit) { guint xid; xid = screensaver->window; g_dbus_proxy_call (screensaver->gs_proxy, "Inhibit", g_variant_new ("(susu)", g_get_application_name (), xid, REASON, GS_NO_IDLE_FLAG), G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, on_inhibit_cb, screensaver); } else { if (screensaver->cookie > 0) { g_dbus_proxy_call (screensaver->gs_proxy, "Uninhibit", g_variant_new ("(u)", screensaver->cookie), G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, on_uninhibit_cb, screensaver); } } }
int main(int argc, char *argv[]) { GtkWidget *window; gtk_init(&argc, &argv); g_set_application_name("This is a test"); gtk_window_set_default_icon_name("foobar"); g_setenv("PULSE_PROP_media.role", "phone", TRUE); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW (window), g_get_application_name()); gtk_widget_show_all(window); m = pa_glib_mainloop_new(NULL); g_assert(m); connect(); gtk_main(); pa_context_unref(ctxt); pa_glib_mainloop_free(m); return 0; }
void gtimer_window_show_about_dialog (GTimerWindow *window) { g_return_if_fail (window != NULL); g_return_if_fail (GTIMER_IS_WINDOW (window)); static const char *authors[] = { "Jente Hidskes <*****@*****.**>", NULL, }; gtk_show_about_dialog (GTK_WINDOW (window), "program-name", g_get_application_name (), "version", PACKAGE_VERSION, "copyright", "Copyright \xc2\xa9 "COPYRIGHT" Jente Hidskes", "comments", _("Count down time"), "authors", authors, "translator-credits", _("translator-credits"), "website-label", _("Website"), "website", PACKAGE_URL, "logo-icon-name", "gnome-clocks", "wrap-license", TRUE, "license-type", GTK_LICENSE_GPL_2_0, NULL); }
/** * aisleriot_show_help: * @window: a parent window to use for error messages * @game_file: the game to show help for, or %NULL to show * general help * * Shows help for @game_file, or the main help if @game_file is %NULL. */ void aisleriot_show_help (GtkWidget *window, const char *game_file) { char *help_section = NULL; GError *error = NULL; if (game_file != NULL) { help_section = game_file_to_help_section (game_file); } if (!games_help_display_full (GTK_WIDGET (window), DOC_MODULE, help_section, &error)) { if (game_file != NULL) { char *help_section_display; help_section_display = games_filename_to_display_name (game_file); games_show_error (window, error, _("Could not show help for “%s”"), help_section_display); } else { games_show_error (window, error, _("Could not show help for “%s”"), g_get_application_name ()); } g_error_free (error); } g_free (help_section); }
/** * gwy_module_browser: * * Shows a simple module browser. **/ void gwy_module_browser(void) { GtkWidget *browser, *scroll, *paned, *info; if (window) { gtk_window_present(GTK_WINDOW(window)); return; } window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 480, 480); gtk_window_set_title(GTK_WINDOW(window), _("Module Browser")); gtk_window_set_wmclass(GTK_WINDOW(window), "browser_module", g_get_application_name()); paned = gtk_vpaned_new(); gtk_container_add(GTK_CONTAINER(window), paned); scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_paned_pack1(GTK_PANED(paned), scroll, TRUE, FALSE); browser = gwy_module_browser_construct(window); gtk_container_add(GTK_CONTAINER(scroll), browser); info = gwy_module_browser_info_table(window); gtk_paned_pack2(GTK_PANED(paned), info, FALSE, FALSE); g_signal_connect(window, "destroy", G_CALLBACK(gtk_widget_destroy), NULL); g_signal_connect_swapped(window, "destroy", G_CALLBACK(g_nullify_pointer), &window); gtk_widget_show_all(window); }
EXPORT_C #endif void _gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details, const gchar * file_name) { gchar *ts_file_name = NULL; GstClockTime elapsed; g_return_if_fail (GST_IS_BIN (bin)); if (!file_name) { file_name = g_get_application_name (); if (!file_name) file_name = "unnamed"; } /* add timestamp */ elapsed = GST_CLOCK_DIFF (_priv_gst_info_start_time, gst_util_get_timestamp ()); ts_file_name = g_strdup_printf ("%" GST_TIME_FORMAT "-%s", GST_TIME_ARGS (elapsed), file_name); _gst_debug_bin_to_dot_file (bin, details, ts_file_name); g_free (ts_file_name); }
static GObject * legacy_status_icon_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; LegacyStatusIcon * self; GtkStatusIcon* _tmp0_; GtkStatusIcon* _tmp1_; const gchar* _tmp2_ = NULL; GtkStatusIcon* _tmp3_; GtkStatusIcon* _tmp4_; parent_class = G_OBJECT_CLASS (legacy_status_icon_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = LEGACY_STATUS_ICON (obj); _tmp0_ = gtk_status_icon_new (); _g_object_unref0 (self->priv->icon); self->priv->icon = _tmp0_; _tmp1_ = self->priv->icon; _tmp2_ = g_get_application_name (); g_object_set ((GObject*) _tmp1_, "icon-name", "deja-dup-symbolic", "title", _tmp2_, NULL); legacy_status_icon_ensure_menu (self); _tmp3_ = self->priv->icon; g_signal_connect_object (_tmp3_, "popup-menu", (GCallback) _legacy_status_icon_show_menu_gtk_status_icon_popup_menu, self, 0); _tmp4_ = self->priv->icon; g_signal_connect_object (_tmp4_, "activate", (GCallback) __legacy_status_icon___lambda9__gtk_status_icon_activate, self, 0); return obj; }
/* Internal: Load script (enhanced) command from config */ void _verve_db_load_script_rc (VerveDb *db, const XfceRc *rc) { g_return_if_fail (xfce_rc_has_entry (rc, "Target")); g_return_if_fail (xfce_rc_has_entry (rc, "Shell")); /* Get basename of target */ const gchar *basename = xfce_rc_read_entry (rc, "Target", NULL); /* Get resource path */ gchar *resource = g_build_filename (g_get_application_name (), basename, NULL); /* Get absolute filename */ gchar *filename = xfce_resource_lookup (XFCE_RESOURCE_DATA, resource); VerveScriptCommand *cmd; cmd = (VerveScriptCommand *)malloc (sizeof (VerveScriptCommand)); cmd->name = g_strdup (xfce_rc_read_entry (rc, "Name", NULL)); cmd->shell = g_strdup (xfce_rc_read_entry (rc, "Shell", "sh")); cmd->target_filename = g_strdup (filename); g_hash_table_insert (db->script_commands, (gpointer) cmd->name, (gpointer) cmd); g_free (resource); g_free (filename); }
static gint gedit_app_handle_local_options (GApplication *application, GVariantDict *options) { if (g_variant_dict_contains (options, "version")) { g_print ("%s - Version %s\n", g_get_application_name (), VERSION); return 0; } if (g_variant_dict_contains (options, "list-encodings")) { print_all_encodings (); return 0; } if (g_variant_dict_contains (options, "standalone")) { GApplicationFlags old_flags; old_flags = g_application_get_flags (application); g_application_set_flags (application, old_flags | G_APPLICATION_NON_UNIQUE); } if (g_variant_dict_contains (options, "wait")) { GApplicationFlags old_flags; old_flags = g_application_get_flags (application); g_application_set_flags (application, old_flags | G_APPLICATION_IS_LAUNCHER); } return -1; }
static void add_recent_file (const gchar *filename) { GtkRecentData recent_data; gchar *uri = NULL; #ifdef G_OS_WIN32 recent_data.mime_type = get_mime_type_from_uri (filename, NULL); #else recent_data.mime_type = get_mime_type (filename); #endif if (recent_data.mime_type == NULL) return; recent_data.display_name = g_filename_display_basename (filename); recent_data.app_name = g_strdup (g_get_application_name ()); recent_data.app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL); recent_data.description = NULL; recent_data.groups = NULL; recent_data.is_private = FALSE; uri = g_filename_to_uri(filename, NULL, NULL); gtk_recent_manager_add_full(gtk_recent_manager_get_default(), uri, &recent_data); g_free (recent_data.display_name); g_free (recent_data.mime_type); g_free (recent_data.app_name); g_free (recent_data.app_exec); g_free (uri); }
void adwaita_draw_flat_box (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height) { const gchar *app_name; GTK_STYLE_CLASS (adwaita_style_parent_class)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); /* HACK: this is totally awful, but I don't see a better way to "tag" the OO.o hierarchy */ if (!GTK_IS_WINDOW (widget) || (gtk_window_get_window_type (GTK_WINDOW (widget)) != GTK_WINDOW_TOPLEVEL)) return; app_name = g_get_application_name (); if (g_str_has_prefix (app_name, "OpenOffice.org")) do_toplevel_hack (widget, "openoffice-toplevel"); else if (g_str_has_prefix (app_name, "LibreOffice")) do_toplevel_hack (widget, "libreoffice-toplevel"); }
/* * gst_debug_bin_to_dot_file_with_ts: * @bin: the top-level pipeline that should be analyzed * @file_name: output base filename (e.g. "myplayer") * * This works like gst_debug_bin_to_dot_file(), but adds the current timestamp * to the filename, so that it can be used to take multiple snapshots. */ void gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details, const gchar * file_name) { gchar *ts_file_name = NULL; GstClockTime elapsed; g_return_if_fail (GST_IS_BIN (bin)); if (!file_name) { file_name = g_get_application_name (); if (!file_name) file_name = "unnamed"; } /* add timestamp */ elapsed = GST_CLOCK_DIFF (_priv_gst_info_start_time, gst_util_get_timestamp ()); /* we don't use GST_TIME_FORMAT as such filenames would fail on some * filesystems like fat */ ts_file_name = g_strdup_printf ("%u.%02u.%02u.%09u-%s", GST_TIME_ARGS (elapsed), file_name); gst_debug_bin_to_dot_file (bin, details, ts_file_name); g_free (ts_file_name); }
static void show_version_and_quit (void) { g_print ("%s - Version %s\n", g_get_application_name (), VERSION); exit (0); }
/** * application_history_update_list: * @uri: * * Adds @uri to the application's history of files. **/ void gnm_app_history_add (char const *uri, const char *mimetype) { GtkRecentData rd; if (app->recent == NULL) return; memset (&rd, 0, sizeof (rd)); #if 0 g_print ("uri: %s\nmime: %s\n\n", uri, mimetype ? mimetype : "-"); #endif rd.mime_type = g_strdup (mimetype ? mimetype : "application/octet-stream"); rd.app_name = g_strdup (g_get_application_name ()); rd.app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL); rd.groups = NULL; rd.is_private = FALSE; if (!gtk_recent_manager_add_full (app->recent, uri, &rd)) { /* Now what? */ g_printerr ("Warning: failed to update recent document.\n"); } g_free (rd.mime_type); g_free (rd.app_name); g_free (rd.app_exec); g_object_notify (G_OBJECT (app), "file-history-list"); }
/* The GeditRecentConfiguration struct is allocated and owned by the caller */ void gedit_recent_configuration_init_default (GeditRecentConfiguration *config) { GSettings *settings; config->manager = gtk_recent_manager_get_default (); if (config->filter != NULL) { g_object_unref (config->filter); } config->filter = gtk_recent_filter_new (); gtk_recent_filter_add_application (config->filter, g_get_application_name ()); gtk_recent_filter_add_mime_type (config->filter, "text/plain"); g_object_ref_sink (config->filter); settings = g_settings_new ("org.gnome.gedit.preferences.ui"); g_settings_get (settings, GEDIT_SETTINGS_MAX_RECENTS, "u", &config->limit); g_object_unref (settings); config->show_not_found = TRUE; config->show_private = FALSE; config->local_only = FALSE; config->substring_filter = NULL; }
void tracker_log_shutdown (void) { if (!initialized) { return; } g_message ("Stopping %s %s", g_get_application_name (), PACKAGE_VERSION); /* Reset default log handler */ g_log_set_default_handler (g_log_default_handler, NULL); if (log_handler_id) { g_log_remove_handler (G_LOG_DOMAIN, log_handler_id); log_handler_id = 0; } if (libmediaart_log_handler_id) { g_log_remove_handler ("libmediaart", libmediaart_log_handler_id); libmediaart_log_handler_id = 0; } if (use_log_files && fd != NULL) { fclose (fd); } g_mutex_clear (&mutex); initialized = FALSE; }
/* GObject init a VerveDb instance */ static void verve_db_init (VerveDb *db) { /* Init hash tables */ db->simple_commands = g_hash_table_new (g_str_hash, g_str_equal); db->script_commands = g_hash_table_new (g_str_hash, g_str_equal); /* Create resource path pattern for .desktop files */ gchar *filename_pattern = g_build_filename (g_get_application_name (), "*.desktop", NULL); /* Determine available .desktop files */ gchar **filenames = xfce_resource_match (XFCE_RESOURCE_CONFIG, filename_pattern, TRUE); g_free (filename_pattern); if (G_LIKELY (filenames != NULL)) { int i = 0; /* Iterate over filenames */ gchar *filename = filenames[i]; while (G_LIKELY (filename != NULL)) { /* Load command structure */ _verve_db_load_rc (db, filename); /* Step over to the next filename */ filename = filenames[++i]; } } /** Free .desktop filenames */ g_strfreev (filenames); }
static gboolean acquire_bus_name(DBusConnection *connection, const char *server, gboolean replace_existing, const char *bus_name, GError **error) { DBusError derror; unsigned int flags; int result; flags = DBUS_NAME_FLAG_DO_NOT_QUEUE | DBUS_NAME_FLAG_ALLOW_REPLACEMENT; if (replace_existing) flags |= DBUS_NAME_FLAG_REPLACE_EXISTING; dbus_error_init(&derror); result = dbus_bus_request_name(connection, bus_name, flags, &derror); if (dbus_error_is_set(&derror)) { propagate_dbus_error(error, &derror); return FALSE; } if (!(result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER || result == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER)) { g_set_error(error, HIPPO_ERROR, HIPPO_ERROR_ALREADY_RUNNING, _("Another copy of %s is already running in this session for server %s"), g_get_application_name(), server); return FALSE; } g_debug("Acquired bus name %s", bus_name); return TRUE; }
static void init_application_name(void) { const char *application_name = NULL; application_name = g_get_application_name(); if (!application_name) g_set_application_name("Python"); }
/** * gnm_app_history_get_list: * * creating it if necessary. * * Return value: (element-type char) (transfer full): the list, which must be * freed along with the strings in it. **/ GSList * gnm_app_history_get_list (int max_elements) { GSList *res = NULL; GList *items, *l; GtkFileFilter *filter; int n_elements = 0; if (app->recent == NULL) return NULL; items = gtk_recent_manager_get_items (app->recent); items = g_list_sort (items, (GCompareFunc)compare_mru); filter = gnm_app_create_opener_filter (NULL); for (l = items; l && n_elements < max_elements; l = l->next) { GtkRecentInfo *ri = l->data; const char *uri = gtk_recent_info_get_uri (ri); gboolean want_it; if (gtk_recent_info_has_application (ri, g_get_application_name ())) { want_it = TRUE; } else { GtkFileFilterInfo fi; char *display_name = g_filename_display_basename (uri); memset (&fi, 0, sizeof (fi)); fi.contains = (GTK_FILE_FILTER_MIME_TYPE | GTK_FILE_FILTER_URI | GTK_FILE_FILTER_DISPLAY_NAME); fi.uri = uri; fi.mime_type = gtk_recent_info_get_mime_type (ri); fi.display_name = display_name; want_it = gtk_file_filter_filter (filter, &fi); g_free (display_name); } if (want_it) { char *filename = go_filename_from_uri (uri); if (filename && !g_file_test (filename, G_FILE_TEST_EXISTS)) want_it = FALSE; g_free (filename); } if (want_it) { res = g_slist_prepend (res, g_strdup (uri)); n_elements++; } } g_list_free_full (items, (GDestroyNotify)gtk_recent_info_unref); g_object_ref_sink (filter); g_object_unref (filter); return g_slist_reverse (res); }
/** * tracker_miner_manager_pause_for_process: * @manager: a #TrackerMinerManager. * @miner: miner reference * @reason: reason to pause * @cookie: (out) (allow-none): return location for the pause cookie ID * * This function operates exactly the same way as * tracker_miner_manager_pause() with the exception that if the calling * process dies, the pause is resumed. This API is useful for cases * where the calling process has a risk of crashing without resuming * the pause. * * NOTE: If you call g_object_unref() on the @manager before you * intend to resume the pause and it finalizes, it will automatically * resume. * * Returns: %TRUE if the miner was paused successfully, otherwise * %FALSE. * * Since: 0.10.15 **/ gboolean tracker_miner_manager_pause_for_process (TrackerMinerManager *manager, const gchar *miner, const gchar *reason, guint32 *cookie) { GDBusProxy *proxy; const gchar *app_name; GError *error = NULL; GVariant *v; g_return_val_if_fail (TRACKER_IS_MINER_MANAGER (manager), FALSE); g_return_val_if_fail (miner != NULL, FALSE); g_return_val_if_fail (reason != NULL, FALSE); proxy = find_miner_proxy (manager, miner, TRUE); if (!proxy) { g_critical ("No D-Bus proxy found for miner '%s'", miner); return FALSE; } /* Find a reasonable app name */ app_name = g_get_application_name (); if (!app_name) { app_name = g_get_prgname (); } if (!app_name) { app_name = "TrackerMinerManager client"; } v = g_dbus_proxy_call_sync (proxy, "PauseForProcess", g_variant_new ("(ss)", app_name, reason), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); if (error) { g_critical ("Could not pause miner '%s': %s", miner, error->message); g_error_free (error); return FALSE; } if (cookie) { g_variant_get (v, "(i)", cookie); } g_variant_unref (v); return TRUE; }
void __recent_add_utf8_filename (const gchar *utf8_filename) { GtkRecentData *recent_data; gchar *filename; gchar *uri; gchar *pwd; static gchar *groups[2] = { "gnomint", NULL }; recent_data = g_slice_new (GtkRecentData); recent_data->display_name = NULL; recent_data->description = NULL; recent_data->mime_type = GNOMINT_MIME_TYPE; recent_data->app_name = (gchar *) g_get_application_name (); recent_data->app_exec = g_strjoin (" ", g_get_prgname (), "%f", NULL); recent_data->groups = groups; recent_data->is_private = FALSE; filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL); if ( filename != NULL ) { if (! g_path_is_absolute (filename)) { gchar *absolute_filename; pwd = g_get_current_dir (); absolute_filename = g_build_filename (pwd, filename, NULL); g_free (pwd); g_free (filename); filename = absolute_filename; } uri = g_filename_to_uri (filename, NULL, NULL); if ( uri != NULL ) { gtk_recent_manager_add_full (recent_manager, uri, recent_data); g_free (uri); } g_free (filename); } g_free (recent_data->app_exec); g_slice_free (GtkRecentData, recent_data); }
static gboolean vino_prompt_setup_dialog (VinoPrompt *prompt) { if (!notify_is_initted () && !notify_init (g_get_application_name ())) { g_printerr (_("Error initializing libnotify\n")); return FALSE; } return TRUE; }
gboolean option_version_cb (const gchar *option_name, const gchar *value, gpointer data, GError **error) { g_print ("%s (xpstools) %s\n" "Copyright (C) 2011 Jason Crain.\n" "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n", g_get_application_name (), VERSION); exit (0); }
static void gtk_application_window_update_shell_shows_app_menu (GtkApplicationWindow *window, GtkSettings *settings) { gboolean shown_by_shell; gboolean shown_by_titlebar; g_object_get (settings, "gtk-shell-shows-app-menu", &shown_by_shell, NULL); shown_by_titlebar = _gtk_window_titlebar_shows_app_menu (GTK_WINDOW (window)); if (shown_by_shell || shown_by_titlebar) { /* the shell shows it, so don't show it locally */ if (g_menu_model_get_n_items (G_MENU_MODEL (window->priv->app_menu_section)) != 0) g_menu_remove (window->priv->app_menu_section, 0); } else { /* the shell does not show it, so make sure we show it */ if (g_menu_model_get_n_items (G_MENU_MODEL (window->priv->app_menu_section)) == 0) { GMenuModel *app_menu = NULL; if (gtk_window_get_application (GTK_WINDOW (window)) != NULL) app_menu = gtk_application_get_app_menu (gtk_window_get_application (GTK_WINDOW (window))); if (app_menu != NULL) { const gchar *app_name; gchar *name; app_name = g_get_application_name (); if (app_name != g_get_prgname ()) { /* the app has set its application name, use it */ name = g_strdup (app_name); } else { /* get the name from .desktop file */ name = gtk_application_window_get_app_desktop_name (); if (name == NULL) name = g_strdup (_("Application")); } g_menu_append_submenu (window->priv->app_menu_section, name, app_menu); g_free (name); } } } }
gchar * gst_pulse_client_name (void) { gchar buf[PATH_MAX]; const char *c; if ((c = g_get_application_name ())) return g_strdup (c); else if (pa_get_binary_name (buf, sizeof (buf))) return g_strdup (buf); else return g_strdup ("GStreamer"); }
gchar * gst_pulse_client_name (void) { gchar buf[PATH_MAX]; const char *c; if ((c = g_get_application_name ())) return g_strdup (c); else if (pa_get_binary_name (buf, sizeof (buf))) return g_strdup (buf); else return g_strdup_printf ("GStreamer-pid-%lu", (gulong) getpid ()); }