533
532
//\______________ add a preview widget next to the treeview
534
533
GtkWidget *pPreviewBox = cairo_dock_gui_make_preview_box (GTK_WIDGET (pThemesWidget->pMainWindow), pOneWidget, FALSE, 2, NULL, CAIRO_DOCK_SHARE_DATA_DIR"/images/"CAIRO_DOCK_LOGO, pDataGarbage);
535
// vertical packaging.
536
534
GtkWidget *pWidgetBox = _gtk_hbox_new (CAIRO_DOCK_GUI_MARGIN);
537
535
gtk_box_pack_start (GTK_BOX (pWidgetBox), pScrolledWindow, TRUE, TRUE, 0);
538
536
gtk_box_pack_start (GTK_BOX (pWidgetBox), pPreviewBox, TRUE, TRUE, 0);
540
//\______________ get the local, shared and distant themes.
538
//\______________ get the user, shared and distant themes.
541
539
_fill_treeview_with_themes (pThemesWidget);
543
541
//\______________ insert the widget.
545
543
gtk_box_pack_start (GTK_BOX (myWidget->pKeyBox), pWidgetBox, FALSE, FALSE, 0);
546
static gboolean _ignore_server_themes (const gchar *cThemeName, CairoDockPackage *pTheme, gpointer data)
548
gchar *cVersionFile = g_strdup_printf ("%s/last-modif", pTheme->cPackagePath);
549
gboolean bRemove = g_file_test (cVersionFile, G_FILE_TEST_EXISTS);
550
g_free (cVersionFile);
553
static void _make_combo_for_user_themes (ThemesWidget *pThemesWidget, GPtrArray *pDataGarbage, GKeyFile* pKeyFile)
555
//\______________ get the group/key widget
556
GSList *pWidgetList = pThemesWidget->widget.pWidgetList;
557
CairoDockGroupKeyWidget *myWidget = cairo_dock_gui_find_group_key_widget_in_list (pWidgetList, "Save", "theme name");
558
g_return_if_fail (myWidget != NULL);
560
//\______________ build the combo-box.
561
GtkWidget *pOneWidget = cairo_dock_gui_make_combo (TRUE);
563
//\______________ get the user themes.
564
const gchar *cUserThemesDir = g_cThemesDirPath;
565
GHashTable *pThemeTable = cairo_dock_list_packages (NULL, cUserThemesDir, NULL, NULL);
566
g_hash_table_foreach_remove (pThemeTable, (GHRFunc)_ignore_server_themes, NULL); // ignore themes coming from the server
567
GtkTreeModel *pModel = gtk_combo_box_get_model (GTK_COMBO_BOX (pOneWidget));
568
cairo_dock_fill_model_with_themes (GTK_LIST_STORE (pModel), pThemeTable, NULL);
570
//\______________ insert the widget.
571
GtkWidget *pHBox = _gtk_hbox_new (CAIRO_DOCK_GUI_MARGIN);
572
GtkWidget *pLabel = gtk_label_new (_("Save as:"));
574
//\______________ add a preview widget under to the combo
575
GtkWidget *pPreviewBox = cairo_dock_gui_make_preview_box (GTK_WIDGET (pThemesWidget->pMainWindow), pOneWidget, FALSE, 1, NULL, NULL, pDataGarbage);
576
GtkWidget *pWidgetBox = _gtk_vbox_new (CAIRO_DOCK_GUI_MARGIN);
578
/*gtk_box_pack_start (GTK_BOX (pHBox), pLabel, FALSE, FALSE, 0);
579
gtk_box_pack_end (GTK_BOX (pHBox), pOneWidget, FALSE, FALSE, 0);
580
gtk_box_pack_start (GTK_BOX (pWidgetBox), pHBox, FALSE, FALSE, 0);
581
gtk_box_pack_start (GTK_BOX (pWidgetBox), pPreviewBox, FALSE, FALSE, 0);
582
gtk_box_pack_start (GTK_BOX (myWidget->pKeyBox), pWidgetBox, FALSE, FALSE, 0);*/
584
GtkWidget *pAlign = gtk_alignment_new (0, 0, 1, 0);
585
gtk_container_add (GTK_CONTAINER (pAlign), pLabel);
586
gtk_box_pack_start (GTK_BOX (pHBox), pAlign, FALSE, FALSE, 0);
587
gtk_box_pack_end (GTK_BOX (pHBox), pWidgetBox, FALSE, FALSE, 0);
588
gtk_box_pack_start (GTK_BOX (pWidgetBox), pOneWidget, FALSE, FALSE, 0);
589
gtk_box_pack_start (GTK_BOX (pWidgetBox), pPreviewBox, FALSE, FALSE, 0);
590
gtk_box_pack_start (GTK_BOX (myWidget->pKeyBox), pHBox, TRUE, TRUE, 0);
592
myWidget->pSubWidgetList = g_slist_append (myWidget->pSubWidgetList, pOneWidget);
548
594
static void _build_themes_widget (ThemesWidget *pThemesWidget)
550
596
GtkWindow *pMainWindow = pThemesWidget->pMainWindow;