static void create_page (GKeyFile *key_file, GtkWidget *box) { GtkWidget *grid; GList *entries; GtkSizeGroup *label_size_group; char *type; entries = NULL; type = g_key_file_get_string (key_file, MAIN_GROUP, "Type", NULL); if (g_strcmp0 (type, "Link") == 0) { entries = g_list_prepend (entries, item_entry_new ("Comment", _("Comment"), TRUE, FALSE)); entries = g_list_prepend (entries, item_entry_new ("URL", _("URL"), FALSE, TRUE)); entries = g_list_prepend (entries, item_entry_new ("GenericName", _("Description"), TRUE, FALSE)); } else if (g_strcmp0 (type, "Application") == 0) { entries = g_list_prepend (entries, item_entry_new ("Comment", _("Comment"), TRUE, FALSE)); entries = g_list_prepend (entries, item_entry_new ("Exec", _("Command"), FALSE, FALSE)); entries = g_list_prepend (entries, item_entry_new ("GenericName", _("Description"), TRUE, FALSE)); } else { /* we only handle launchers and links */ /* ensure that we build an empty gid with a dummy row at the end */ goto build_grid; } g_free (type); build_grid: label_size_group = g_object_get_data (G_OBJECT (box), "label-size-group"); grid = build_grid (box, key_file, label_size_group, entries); g_list_free (entries); gtk_box_pack_start (GTK_BOX (box), grid, FALSE, TRUE, 0); gtk_widget_show_all (GTK_WIDGET (box)); }
static void create_page (GnomeDesktopItem *item, GtkWidget *box) { GtkWidget *table; GList *entries; GnomeDesktopItemType item_type; GtkLabel *label; entries = NULL; label = g_object_get_data (G_OBJECT (box), "label"); item_type = gnome_desktop_item_get_entry_type (item); if (item_type == GNOME_DESKTOP_ITEM_TYPE_LINK) { entries = g_list_prepend (entries, item_entry_new (GNOME_DESKTOP_ITEM_COMMENT, _("Comment"), TRUE, FALSE)); entries = g_list_prepend (entries, item_entry_new (GNOME_DESKTOP_ITEM_URL, _("URL"), FALSE, TRUE)); entries = g_list_prepend (entries, item_entry_new (GNOME_DESKTOP_ITEM_GENERIC_NAME, _("Description"), TRUE, FALSE)); gtk_label_set_text (label, _("Link")); } else if (item_type == GNOME_DESKTOP_ITEM_TYPE_APPLICATION) { entries = g_list_prepend (entries, item_entry_new (GNOME_DESKTOP_ITEM_COMMENT, _("Comment"), TRUE, FALSE)); entries = g_list_prepend (entries, item_entry_new (GNOME_DESKTOP_ITEM_EXEC, _("Command"), FALSE, FALSE)); entries = g_list_prepend (entries, item_entry_new (GNOME_DESKTOP_ITEM_GENERIC_NAME, _("Description"), TRUE, FALSE)); gtk_label_set_text (label, _("Launcher")); } else { /* we only handle launchers and links */ return; } gnome_desktop_item_ref (item); g_object_weak_ref (G_OBJECT (box), box_weak_cb, item); table = build_table (item, entries, 2); g_list_free (entries); gtk_box_pack_start (GTK_BOX (box), table, FALSE, TRUE, 0); gtk_widget_show_all (GTK_WIDGET (box)); }