42
42
#include "cairo-dock-gui-manager.h"
43
43
#include "cairo-dock-gui-commons.h"
44
44
#include "cairo-dock-gui-backend.h"
45
#include "cairo-dock-gui-items.h"
45
46
#include "cairo-dock-gui-main.h"
47
48
#define CAIRO_DOCK_GROUP_ICON_SIZE 32
2149
static void reload_current_widget (int iShowPage)
2151
g_return_if_fail (s_pCurrentGroup != NULL && s_pCurrentGroup->cConfFilePath != NULL);
2153
CairoDockModule *pModule = cairo_dock_find_module_from_name (s_pCurrentGroup->cGroupName);
2154
g_return_if_fail (pModule != NULL && pModule->pInstancesList != NULL);
2156
CairoDockModuleInstance *pModuleInstance;
2158
for (pElement = pModule->pInstancesList; pElement != NULL; pElement= pElement->next)
2150
static inline gboolean _module_is_opened (CairoDockModuleInstance *pInstance)
2152
if (s_pMainWindow == NULL || s_pCurrentGroup == NULL || s_pCurrentGroup->cGroupName == NULL || s_pCurrentGroup->cConfFilePath == NULL || s_pCurrentWidgetList == NULL || pInstance == NULL || pInstance->cConfFilePath == NULL)
2155
if (strcmp (pInstance->pModule->pVisitCard->cModuleName, s_pCurrentGroup->cGroupName) != 0) // est-on est en train d'editer ce module dans le panneau de conf.
2158
if (strcmp (pInstance->cConfFilePath, s_pCurrentGroup->cConfFilePath) != 0)
2159
return FALSE; // est-ce cette instance.
2164
static void reload_current_widget (CairoDockModuleInstance *pInstance, int iShowPage)
2166
if (! _module_is_opened (pInstance))
2160
pModuleInstance = pElement->data;
2161
if (strcmp (pModuleInstance->cConfFilePath, s_pCurrentGroup->cConfFilePath) == 0)
2168
cairo_dock_gui_items_reload_current_widget (pInstance, iShowPage);
2164
g_return_if_fail (pElement != NULL);
2166
_reload_current_module_widget (pModuleInstance, iShowPage);
2172
_reload_current_module_widget (pInstance, iShowPage);
2169
2175
static GtkWidget *cairo_dock_present_group_widget (const gchar *cConfFilePath, CairoDockGroupDescription *pGroupDescription, gboolean bSingleGroup, CairoDockModuleInstance *pInstance)
2295
if (pInstance != NULL && pGroupDescription->load_custom_widget != NULL)
2296
pGroupDescription->load_custom_widget (pInstance, pKeyFile);
2297
g_key_file_free (pKeyFile);
2299
2301
//\_______________ On affiche le widget du groupe dans l'interface.
2300
2302
cairo_dock_hide_all_categories ();
2302
cairo_dock_insert_extern_widget_in_gui (pWidget); // devient le widget courant.
2304
2304
s_pCurrentGroup = pGroupDescription;
2306
2306
gtk_window_set_title (GTK_WINDOW (s_pMainWindow), dgettext (pGroupDescription->cGettextDomain, pGroupDescription->cTitle));
2308
if (pInstance != NULL && pGroupDescription->load_custom_widget != NULL)
2309
pGroupDescription->load_custom_widget (pInstance, pKeyFile);
2311
cairo_dock_insert_extern_widget_in_gui (pWidget); // devient le widget courant.
2313
g_key_file_free (pKeyFile);
2308
2315
//\_______________ On met a jour la frame du groupe (label + check-button).
2309
2316
GtkWidget *pLabel = gtk_label_new (NULL);
2310
2317
gchar *cLabel = g_strdup_printf ("<span font_desc=\"Sans 12\" color=\"#81728C\"><u><b>%s</b></u></span>", dgettext (pGroupDescription->cGettextDomain, pGroupDescription->cTitle));
2604
static inline gboolean _module_is_opened (CairoDockModuleInstance *pInstance)
2606
if (s_pMainWindow == NULL || s_pCurrentGroup == NULL || s_pCurrentGroup->cGroupName == NULL || s_pCurrentGroup->cConfFilePath == NULL || s_pCurrentWidgetList == NULL || pInstance == NULL || pInstance->cConfFilePath == NULL)
2609
if (strcmp (pInstance->pModule->pVisitCard->cModuleName, s_pCurrentGroup->cGroupName) != 0) // est-on est en train d'editer ce module dans le panneau de conf.
2612
if (strcmp (pInstance->cConfFilePath, s_pCurrentGroup->cConfFilePath) != 0)
2613
return FALSE; // est-ce cette instance.
2617
2611
static inline gboolean _desklet_is_opened (CairoDesklet *pDesklet)
2619
2613
if (s_pMainWindow == NULL || pDesklet == NULL)
2629
2623
static void update_desklet_params (CairoDesklet *pDesklet)
2631
2625
if (! _desklet_is_opened (pDesklet))
2627
cairo_dock_gui_items_update_desklet_params (pDesklet);
2634
2630
cairo_dock_update_desklet_widgets (pDesklet, s_pCurrentWidgetList);
2637
2633
static void update_desklet_visibility_params (CairoDesklet *pDesklet)
2639
2635
if (! _desklet_is_opened (pDesklet))
2637
cairo_dock_update_desklet_visibility_params (pDesklet);
2642
2640
cairo_dock_update_desklet_visibility_widgets (pDesklet, s_pCurrentWidgetList);
2645
2643
static void update_module_instance_container (CairoDockModuleInstance *pInstance, gboolean bDetached)
2647
2645
if (! _module_is_opened (pInstance))
2647
cairo_dock_gui_items_update_module_instance_container (pInstance, bDetached);
2650
2650
cairo_dock_update_is_detached_widget (bDetached, s_pCurrentWidgetList);
2711
2711
gtk_statusbar_push (GTK_STATUSBAR (s_pStatusBar), 0, cMessage);
2714
static CairoDockGroupKeyWidget *get_widget_from_name (const gchar *cGroupName, const gchar *cKeyName)
2714
static CairoDockGroupKeyWidget *get_widget_from_name (CairoDockModuleInstance *pInstance, const gchar *cGroupName, const gchar *cKeyName)
2716
g_return_val_if_fail (s_pCurrentWidgetList != NULL, NULL);
2716
if (!_module_is_opened (pInstance))
2717
return cairo_dock_gui_items_get_widget_from_name (pInstance, cGroupName, cKeyName);
2717
2719
CairoDockGroupKeyWidget *pGroupKeyWidget = cairo_dock_gui_find_group_key_widget_in_list (s_pCurrentWidgetList, cGroupName, cKeyName);
2718
2720
if (pGroupKeyWidget == NULL && s_pExtraCurrentWidgetList != NULL)
2733
2735
CairoDockMainGuiBackend *pBackend = g_new0 (CairoDockMainGuiBackend, 1);
2735
pBackend->show_main_gui = show_main_gui;
2736
pBackend->show_module_gui = show_module_gui;
2737
pBackend->show_main_gui = show_main_gui;
2738
pBackend->show_module_gui = show_module_gui;
2737
2739
//pBackend->show_module_instance_gui = show_module_instance_gui;
2738
pBackend->close_gui = close_gui;
2739
pBackend->update_module_state = update_module_state;
2740
pBackend->update_desklet_params = update_desklet_params;
2741
pBackend->update_desklet_visibility_params = update_desklet_visibility_params;
2742
pBackend->update_module_instance_container = update_module_instance_container;
2743
pBackend->update_modules_list = update_modules_list;
2744
pBackend->bCanManageThemes = FALSE;
2745
pBackend->cDisplayedName = _("Advanced Mode");
2746
pBackend->cTooltip = _("The advanced mode lets you tweak every single parameter of the dock. It is a powerful tool to customise your current theme.");
2740
pBackend->close_gui = close_gui;
2741
pBackend->update_module_state = update_module_state;
2742
pBackend->update_desklet_params = update_desklet_params;
2743
pBackend->update_desklet_visibility_params = update_desklet_visibility_params;
2744
pBackend->update_module_instance_container = update_module_instance_container;
2745
pBackend->update_modules_list = update_modules_list;
2746
pBackend->bCanManageThemes = FALSE;
2747
pBackend->cDisplayedName = _("Advanced Mode");
2748
pBackend->cTooltip = _("The advanced mode lets you tweak every single parameter of the dock. It is a powerful tool to customise your current theme.");
2748
2750
cairo_dock_register_config_gui_backend (pBackend);
2750
2752
CairoDockGuiBackend *pConfigBackend = g_new0 (CairoDockGuiBackend, 1);
2752
pConfigBackend->set_status_message_on_gui = set_status_message_on_gui;
2753
pConfigBackend->reload_current_widget = reload_current_widget;
2754
pConfigBackend->set_status_message_on_gui = set_status_message_on_gui;
2755
pConfigBackend->reload_current_widget = reload_current_widget;
2754
2756
pConfigBackend->show_module_instance_gui = show_module_instance_gui;
2755
pConfigBackend->get_widget_from_name = get_widget_from_name;
2757
pConfigBackend->get_widget_from_name = get_widget_from_name;
2757
2759
cairo_dock_register_gui_backend (pConfigBackend);