static void panel_launcher_create_with_id (const char *toplevel_id, PanelObjectPackType pack_type, int pack_index, const char *location) { char *id; GSettings *settings; GSettings *settings_instance; char *no_uri; const char *new_location; g_return_if_fail (location != NULL); id = panel_layout_object_create_start (PANEL_OBJECT_LAUNCHER, NULL, toplevel_id, pack_type, pack_index, &settings); no_uri = NULL; /* if we have an URI, it might contain escaped characters (? : etc) * that might get unescaped on disk */ if (!g_ascii_strncasecmp (location, "file:", strlen ("file:"))) no_uri = g_filename_from_uri (location, NULL, NULL); if (!no_uri) no_uri = g_strdup (location); new_location = panel_launcher_get_filename (no_uri); if (new_location == NULL) new_location = no_uri; settings_instance = panel_layout_get_instance_settings (settings, PANEL_LAUNCHER_SCHEMA); g_settings_set_string (settings_instance, PANEL_LOCATION_KEY, new_location); panel_layout_object_create_finish (id); g_object_unref (settings_instance); g_object_unref (settings); g_free (no_uri); g_free (id); }
void panel_layout_object_create (PanelObjectType type, const char *type_detail, const char *toplevel_id, PanelObjectPackType pack_type, int pack_index) { char *id; id = panel_layout_object_create_start (type, type_detail, toplevel_id, pack_type, pack_index, NULL); if (!id) return; panel_layout_object_create_finish (id); g_free (id); }