Home Forums Wiki Doc Install Extras Screenshots Source Code Projects Blog Users Groups Register
Glx-Dock / Cairo-Dock List of forums Git Version | Version Git GUI: Avoid the possibility to add a subdock inside the subdock which has the first subdock as parent
The latest stable release is the *3.4.0* : How to install it here.
Note: We just switched from BZR to Git on Github! (only to host the code and your future pull requests)
Git Version | Version Git

Subjects Author Language Messages Last message
[Locked] GUI: Avoid the possibility to add a subdock inside the subdock which has the first subdock as parent
matttbe English 2 matttbe [Read]
04 April 2013 à 17:20

matttbe, Thursday 04 April 2013 à 16:40


Subscription date : 24 January 2009
Messages : 12573
There was an annoying case: subdock1->subdock2->subdock1 or subdock1->subdock2->subdock3->(...)->subdock1
  • Now the dock should no longer crash: rev 1454
  • It's no longer possible to have this situation when using the right click menu: rev 1455 && rev 1456
  • But it's still possible to do that from the GUI: @fabounet: any idea how to do that easily? (maybe by using a variable outside functions)?
  • (It's no longer possible to add an icon into the subdock of a launcher/application which has a subdock from the GUI: rev 1453)


PS: if more than one window with the same class are launched before the dock, the main icon of these windows will not be correct.

matttbe, Thursday 04 April 2013 à 16:55


Subscription date : 24 January 2009
Messages : 12573
But it's still possible to do that from the GUI: @fabounet: any idea how to do that easily? (maybe by using a variable outside functions)?
Maybe by doing that?
=== modified file 'src/gldit/cairo-dock-gui-factory.c'
--- src/gldit/cairo-dock-gui-factory.c    2013-04-04 13:07:22 +0000
+++ src/gldit/cairo-dock-gui-factory.c    2013-04-04 14:50:15 +0000
@@ -1191,+1191,42 @@
     return 
_build_list_for_gui ((CDForeachRendererFunc)cairo_dock_foreach_dialog_decorator, (GHFunc)_cairo_dock_add_one_dialog_decorator_itemNULL);
 }
 
+
+static 
gboolean _test_one_name (GtkTreeModel *modelG_GNUC_UNUSED GtkTreePath *pathGtkTreeIter *itergpointer *data)
+{
+    
gchar *cName NULL, *cResult NULL;
+    
gtk_tree_model_get (modeliterCAIRO_DOCK_MODEL_RESULT, &cResult, -1);
+    if (
cResult == NULL)
+        
gtk_tree_model_get (modeliterCAIRO_DOCK_MODEL_NAME, &cName, -1);
+    else if (
data[3])
+        
cairo_dock_extract_package_type_from_name (cResult);
+    if ((
cResult && strcmp (data[0], cResult) == 0) || (cName && strcmp (data[0], cName) == 0))
+    {
+        
GtkTreeIter *iter_to_fill data[1];
+        
memcpy (iter_to_fillitersizeof (GtkTreeIter));
+        
gboolean *bFound data[2];
+        *
bFound TRUE;
+        
g_free (cName);
+        
g_free (cResult);
+        return 
TRUE;
+    }
+    
g_free (cName);
+    
g_free (cResult);
+    return 
FALSE;
+}
+
+static 
gboolean _cairo_dock_find_iter_from_name_full (GtkListStore *pModele, const gchar *cNameGtkTreeIter *itergboolean bIsTheme)
+{
+    if (
cName == NULL)
+        return 
FALSE;
+    
gboolean bFound FALSE;
+    
gconstpointer data[4] = {cNameiter, &bFoundGINT_TO_POINTER (bIsTheme)};
+    
gtk_tree_model_foreach (GTK_TREE_MODEL (pModele), (GtkTreeModelForeachFunc_test_one_namedata);
+    return 
bFound;
+}
+
#define _cairo_dock_find_iter_from_name(pModele, cName, iter) _cairo_dock_find_iter_from_name_full (pModele, cName, iter, FALSE)
+
+
CairoDock *g_pCurrentDock;
 static 
void _cairo_dock_add_one_dock_item (const gchar *cNameCairoDock *pDockGtkListStore *pModele)
 {
     
gchar *cUserName NULL;
@@ -
1199,+1235,@@
         
Icon *pPointingIcon cairo_dock_search_icon_pointing_on_dock (pDockNULL);
         if (
pPointingIcon && ! CAIRO_DOCK_ICON_TYPE_IS_CONTAINER (pPointingIcon)) // only main docks and subdocks
             
return ;
+        if (
g_pCurrentDock != NULL && cairo_dock_is_dock_contains_subdock (g_pCurrentDockpDock))
+            return;
         if (
pDock->iRefCount == 0)
             
cUserName cairo_dock_get_readable_name_for_fock (pDock);
     }
@@ -
1213,10 +1251,17 @@
         
CAIRO_DOCK_MODEL_IMAGE"none", -1);
     
g_free (cUserName);
 }
-static 
GtkListStore *_cairo_dock_build_dock_list_for_gui (void)
+static 
GtkListStore *_cairo_dock_build_dock_list_for_gui (const gchar *cContainerName)
 {
+    
g_pCurrentDock cairo_dock_search_dock_from_name (cContainerName); // can be null
+
     
GtkListStore *pList _build_list_for_gui ((CDForeachRendererFunc)cairo_dock_foreach_docks, (GHFunc)_cairo_dock_add_one_dock_itemNULL);
+
     
GtkTreeIter iter;
+
+    if (
cContainerName && _cairo_dock_find_iter_from_name (pListcContainerName, &iter))
+        
gtk_list_store_remove (pList, &iter);
+
     
memset (&iter0sizeof (GtkTreeIter));
     
gtk_list_store_append (GTK_LIST_STORE (pList), &iter);
     
gtk_list_store_set (GTK_LIST_STORE (pList), &iter,
@@ -
1286,40 +1331,@@
         
CAIRO_DOCK_RUN_AFTER);
 }
 
-static 
gboolean _test_one_name (GtkTreeModel *modelG_GNUC_UNUSED GtkTreePath *pathGtkTreeIter *itergpointer *data)
-{
-    
gchar *cName NULL, *cResult NULL;
-    
gtk_tree_model_get (modeliterCAIRO_DOCK_MODEL_RESULT, &cResult, -1);
-    if (
cResult == NULL)
-        
gtk_tree_model_get (modeliterCAIRO_DOCK_MODEL_NAME, &cName, -1);
-    else if (
data[3])
-        
cairo_dock_extract_package_type_from_name (cResult);
-    if ((
cResult && strcmp (data[0], cResult) == 0) || (cName && strcmp (data[0], cName) == 0))
-    {
-        
GtkTreeIter *iter_to_fill data[1];
-        
memcpy (iter_to_fillitersizeof (GtkTreeIter));
-        
gboolean *bFound data[2];
-        *
bFound TRUE;
-        
g_free (cName);
-        
g_free (cResult);
-        return 
TRUE;
-    }
-    
g_free (cName);
-    
g_free (cResult);
-    return 
FALSE;
-}
-static 
gboolean _cairo_dock_find_iter_from_name_full (GtkListStore *pModele, const gchar *cNameGtkTreeIter *itergboolean bIsTheme)
-{
-    if (
cName == NULL)
-        return 
FALSE;
-    
gboolean bFound FALSE;
-    
gconstpointer data[4] = {cNameiter, &bFoundGINT_TO_POINTER (bIsTheme)};
-    
gtk_tree_model_foreach (GTK_TREE_MODEL (pModele), (GtkTreeModelForeachFunc_test_one_namedata);
-    return 
bFound;
-}
-
#define _cairo_dock_find_iter_from_name(pModele, cName, iter) _cairo_dock_find_iter_from_name_full (pModele, cName, iter, FALSE)
-
-
 static 
void cairo_dock_fill_combo_with_themes (GtkWidget *pComboGHashTable *pThemeTablegchar *cActiveThemegchar *cHint)
 {
     
cd_debug ("%s (%s, %s)"__func__cActiveThemecHint);
@@ -
2500,+2511,@@
             
             case 
CAIRO_DOCK_WIDGET_DOCK_LIST :  // liste des docks existant.
             
{
-                
GtkListStore *pDocksListStore _cairo_dock_build_dock_list_for_gui ();
                 
GtkTreeIter iter;
+                
gchar *cContainerName NULL;
 
                 
// Do not add itself if it's a container
                 
GError *error NULL;
@@ -
2509,12 +2520,10 @@
                 if (
error != NULL// it's certainly not a container
                     
g_error_free (error);
                 else if (
iIconType == CAIRO_DOCK_ICON_TYPE_CONTAINER// it's a container
-                {
-                    
gchar *cContainerName g_key_file_get_string (pKeyFilecGroupName"Name"NULL);
-                    if (
cContainerName && _cairo_dock_find_iter_from_name (pDocksListStorecContainerName, &iter))
-                        
gtk_list_store_remove (pDocksListStore, &iter);
-                    
g_free (cContainerName);
-                }
+                    
cContainerName g_key_file_get_string (pKeyFilecGroupName"Name"NULL);
+
+                
GtkListStore *pDocksListStore _cairo_dock_build_dock_list_for_gui (cContainerName);
+                
g_free (cContainerName);
 
                 
pOneWidget gtk_combo_box_new_with_model (GTK_TREE_MODEL (pDocksListStore));
                 
rend gtk_cell_renderer_text_new ();


But it's not so clean (but easier than rewrite _build_list_for_gui to add a new arg and then modified it to use a "gpointer *" if needed, etc.)

matttbe, Thursday 04 April 2013 à 17:20


Subscription date : 24 January 2009
Messages : 12573
Ok, it was not so complex to modify _build_list_for_gui => rev 1457

Git Version | Version Git

Subjects Author Language Messages Last message
[Locked] GUI: Avoid the possibility to add a subdock inside the subdock which has the first subdock as parent
matttbe English 2 matttbe [Read]
04 April 2013 à 17:20


Glx-Dock / Cairo-Dock List of forums Git Version | Version Git GUI: Avoid the possibility to add a subdock inside the subdock which has the first subdock as parent Top

Online users :

Powered by ElementSpeak © 2007 Adrien Pilleboue, 2009-2013 Matthieu Baerts.
Dock based on CSS Dock Menu (Ndesign) with jQuery. Icons by zgegball
Cairo-Dock is a free software under GNU-GPL3 licence. First stable version created by Fabounet.
Many thanks to TuxFamily for the web Hosting and Mav for the domain name.