comparison gtk3/dw.c @ 782:5a4bfe989f50

Most of the dw_container_* functions now implemented but many untested. Some signal handler work still required but things looking good.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 21 Mar 2011 07:19:33 +0000
parents df6091308b3f
children 9ef49898a5e6
comparison
equal deleted inserted replaced
781:df6091308b3f 782:5a4bfe989f50
1547 return retval; 1547 return retval;
1548 } 1548 }
1549 1549
1550 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data) 1550 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data)
1551 { 1551 {
1552 GtkWidget *item, *widget = (GtkWidget *)gtk_tree_selection_get_tree_view(sel); 1552 GtkWidget *item = NULL, *widget = (GtkWidget *)gtk_tree_selection_get_tree_view(sel);
1553 int retval = FALSE; 1553 int retval = FALSE;
1554 1554
1555 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); 1555 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__);
1556 if(widget) 1556 if(widget)
1557 { 1557 {
1562 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func; 1562 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func;
1563 GtkTreeIter iter; 1563 GtkTreeIter iter;
1564 char *text = NULL; 1564 char *text = NULL;
1565 void *itemdata = NULL; 1565 void *itemdata = NULL;
1566 1566
1567 if(gtk_tree_selection_get_selected(sel, NULL, &iter)) 1567 if(gtk_tree_selection_get_mode(sel) != GTK_SELECTION_MULTIPLE &&
1568 gtk_tree_selection_get_selected(sel, NULL, &iter))
1568 { 1569 {
1569 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); 1570 GtkTreeModel *store = (GtkTreeModel *)gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
1570 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, 3, &item, -1); 1571
1572 if(g_object_get_data(G_OBJECT(widget), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_TREE))
1573 {
1574 gtk_tree_model_get(store, &iter, 0, &text, 2, &itemdata, 3, &item, -1);
1575 }
1576 else
1577 {
1578 gtk_tree_model_get(store, &iter, 0, &text, -1);
1579 }
1571 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata); 1580 retval = treeselectfunc(work.window, (HTREEITEM)item, text, work.data, itemdata);
1572 } 1581 }
1573 } 1582 }
1574 } 1583 }
1575 return retval; 1584 return retval;
2624 PangoContext *pcontext; 2633 PangoContext *pcontext;
2625 GtkWidget *handle2 = handle; 2634 GtkWidget *handle2 = handle;
2626 char *font; 2635 char *font;
2627 char *retfont=NULL; 2636 char *retfont=NULL;
2628 int _locked_by_me = FALSE; 2637 int _locked_by_me = FALSE;
2629 gpointer data;
2630 2638
2631 DW_MUTEX_LOCK; 2639 DW_MUTEX_LOCK;
2632 if(GTK_IS_SCROLLED_WINDOW(handle)) 2640 if(GTK_IS_SCROLLED_WINDOW(handle))
2633 { 2641 {
2634 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 2642 GtkWidget *tmp = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
2635 if(tmp) 2643 if(tmp)
2636 handle2 = tmp; 2644 handle2 = tmp;
2637 } 2645 }
2638
2639 #if 0
2640 /* Free old font name if one is allocated */
2641 data = g_object_get_data(G_OBJECT(handle2), "_dw_fontname");
2642 if(data)
2643 free(data);
2644
2645 g_object_set_data(G_OBJECT(handle2), "_dw_fontname", (gpointer)font);
2646 #endif
2647 2646
2648 pcontext = gtk_widget_get_pango_context( handle2 ); 2647 pcontext = gtk_widget_get_pango_context( handle2 );
2649 if ( pcontext ) 2648 if ( pcontext )
2650 { 2649 {
2651 pfont = pango_context_get_font_description( pcontext ); 2650 pfont = pango_context_get_font_description( pcontext );
3242 HWND dw_menu_append_item(HMENUI menu, char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu) 3241 HWND dw_menu_append_item(HMENUI menu, char *title, unsigned long id, unsigned long flags, int end, int check, HMENUI submenu)
3243 { 3242 {
3244 GtkWidget *tmphandle; 3243 GtkWidget *tmphandle;
3245 char accel, *tempbuf = malloc(strlen(title)+1); 3244 char accel, *tempbuf = malloc(strlen(title)+1);
3246 int _locked_by_me = FALSE, submenucount; 3245 int _locked_by_me = FALSE, submenucount;
3247 guint tmp_key;
3248 GtkAccelGroup *accel_group; 3246 GtkAccelGroup *accel_group;
3249 3247
3250 if (!menu) 3248 if (!menu)
3251 { 3249 {
3252 free(tempbuf); 3250 free(tempbuf);
5433 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col); 5431 gtk_tree_view_append_column(GTK_TREE_VIEW (tree), col);
5434 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col); 5432 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(tree), col);
5435 } 5433 }
5436 /* Finish up */ 5434 /* Finish up */
5437 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), TRUE); 5435 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), TRUE);
5436 gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(tree), TRUE);
5437 gtk_tree_view_set_rubber_banding(GTK_TREE_VIEW(tree), TRUE);
5438 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); 5438 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
5439 if(g_object_get_data(G_OBJECT(handle), "_dw_multi_sel")) 5439 if(g_object_get_data(G_OBJECT(handle), "_dw_multi_sel"))
5440 { 5440 {
5441 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); 5441 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
5442 } 5442 }
5614 { 5614 {
5615 int _locked_by_me = FALSE; 5615 int _locked_by_me = FALSE;
5616 char *file; 5616 char *file;
5617 FILE *fp; 5617 FILE *fp;
5618 GdkPixbuf *pixbuf; 5618 GdkPixbuf *pixbuf;
5619 unsigned long z, ret = 0; 5619 unsigned long ret = 0;
5620 5620
5621 /* 5621 /*
5622 * A real hack; create a temporary file and write the contents 5622 * A real hack; create a temporary file and write the contents
5623 * of the data to the file 5623 * of the data to the file
5624 */ 5624 */
5958 * row: Zero based row of data being set. 5958 * row: Zero based row of data being set.
5959 * title: String title of the item. 5959 * title: String title of the item.
5960 */ 5960 */
5961 void dw_container_set_row_title(void *pointer, int row, char *title) 5961 void dw_container_set_row_title(void *pointer, int row, char *title)
5962 { 5962 {
5963 GtkWidget *cont = pointer;
5964 GtkListStore *store = NULL;
5965 int _locked_by_me = FALSE;
5966
5967 DW_MUTEX_LOCK;
5968 /* Make sure it is the correct tree type */
5969 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
5970 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont));
5971
5972 if(store)
5973 {
5974 GtkTreeIter iter;
5975
5976 if(pointer)
5977 {
5978 row += (int)g_object_get_data(G_OBJECT(cont), "_dw_insertpos");
5979 }
5980
5981 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, row))
5982 {
5983 gtk_list_store_set(store, &iter, 0, (gpointer)title, -1);
5984 }
5985 }
5986 DW_MUTEX_UNLOCK;
5963 } 5987 }
5964 5988
5965 /* 5989 /*
5966 * Sets the title of a row in the container. 5990 * Sets the title of a row in the container.
5967 * Parameters: 5991 * Parameters:
5969 * pointer: Pointer to the allocated memory in dw_container_alloc(). 5993 * pointer: Pointer to the allocated memory in dw_container_alloc().
5970 * rowcount: The number of rows to be inserted. 5994 * rowcount: The number of rows to be inserted.
5971 */ 5995 */
5972 void dw_container_insert(HWND handle, void *pointer, int rowcount) 5996 void dw_container_insert(HWND handle, void *pointer, int rowcount)
5973 { 5997 {
5998 /* Don't need to do anything here */
5974 } 5999 }
5975 6000
5976 /* 6001 /*
5977 * Removes the first x rows from a container. 6002 * Removes the first x rows from a container.
5978 * Parameters: 6003 * Parameters:
5979 * handle: Handle to the window (widget) to be deleted from. 6004 * handle: Handle to the window (widget) to be deleted from.
5980 * rowcount: The number of rows to be deleted. 6005 * rowcount: The number of rows to be deleted.
5981 */ 6006 */
5982 void dw_container_delete(HWND handle, int rowcount) 6007 void dw_container_delete(HWND handle, int rowcount)
5983 { 6008 {
6009 GtkWidget *cont;
6010 GtkListStore *store = NULL;
6011 int _locked_by_me = FALSE;
6012
6013 DW_MUTEX_LOCK;
6014 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
6015
6016 /* Make sure it is the correct tree type */
6017 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6018 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont));
6019
6020 if(store)
6021 {
6022 GtkTreeIter iter;
6023 int rows, z;
6024
6025 rows = (int)g_object_get_data(G_OBJECT(cont), "_dw_rowcount");
6026
6027 for(z=0;z<rowcount;z++)
6028 {
6029 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, 0))
6030 gtk_list_store_remove(store, &iter);
6031 }
6032
6033 if(rows - rowcount < 0)
6034 rows = 0;
6035 else
6036 rows -= rowcount;
6037
6038 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(rows));
6039 }
6040 DW_MUTEX_UNLOCK;
5984 } 6041 }
5985 6042
5986 /* 6043 /*
5987 * Removes all rows from a container. 6044 * Removes all rows from a container.
5988 * Parameters: 6045 * Parameters:
5989 * handle: Handle to the window (widget) to be cleared. 6046 * handle: Handle to the window (widget) to be cleared.
5990 * redraw: TRUE to cause the container to redraw immediately. 6047 * redraw: TRUE to cause the container to redraw immediately.
5991 */ 6048 */
5992 void dw_container_clear(HWND handle, int redraw) 6049 void dw_container_clear(HWND handle, int redraw)
5993 { 6050 {
6051 GtkWidget *cont;
6052 GtkListStore *store = NULL;
6053 int _locked_by_me = FALSE;
6054
6055 DW_MUTEX_LOCK;
6056 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
6057
6058 /* Make sure it is the correct tree type */
6059 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6060 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont));
6061
6062 if(store)
6063 {
6064 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(0));
6065 g_object_set_data(G_OBJECT(cont), "_dw_insertpos", GINT_TO_POINTER(0));
6066
6067 gtk_list_store_clear(store);
6068 }
6069 DW_MUTEX_UNLOCK;
5994 } 6070 }
5995 6071
5996 /* 6072 /*
5997 * Scrolls container up or down. 6073 * Scrolls container up or down.
5998 * Parameters: 6074 * Parameters:
6013 * return items that are currently selected. Otherwise 6089 * return items that are currently selected. Otherwise
6014 * it will return all records in the container. 6090 * it will return all records in the container.
6015 */ 6091 */
6016 char *dw_container_query_start(HWND handle, unsigned long flags) 6092 char *dw_container_query_start(HWND handle, unsigned long flags)
6017 { 6093 {
6094 GtkWidget *cont;
6095 GtkListStore *store = NULL;
6018 char *retval = NULL; 6096 char *retval = NULL;
6019 int _locked_by_me = FALSE; 6097 int _locked_by_me = FALSE;
6020 6098
6099 DW_MUTEX_LOCK;
6100 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
6101
6102 /* Make sure it is the correct tree type */
6103 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6104 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont));
6105
6106 if(store)
6107 {
6108 /* These should be separate but right now this will work */
6109 if(flags & DW_CRA_SELECTED)
6110 {
6111 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont));
6112 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL);
6113 if(list)
6114 {
6115 GtkTreePath *path = g_list_nth_data(list, 0);
6116
6117 if(path)
6118 {
6119 gint *indices = gtk_tree_path_get_indices(path);
6120
6121 if(indices)
6122 {
6123 GtkTreeIter iter;
6124
6125 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0]))
6126 {
6127 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1);
6128 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1));
6129 }
6130 }
6131 }
6132 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL);
6133 g_list_free(list);
6134 }
6135 }
6136 else if(flags & DW_CRA_CURSORED)
6137 {
6138 GtkTreePath *path;
6139
6140 gtk_tree_view_get_cursor(GTK_TREE_VIEW(cont), &path, NULL);
6141 if(path)
6142 {
6143 GtkTreeIter iter;
6144
6145 if(gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path))
6146 {
6147 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1);
6148 }
6149 gtk_tree_path_free(path);
6150 }
6151 }
6152 else
6153 {
6154 GtkTreeIter iter;
6155
6156 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, 0))
6157 {
6158 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1);
6159 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(1));
6160 }
6161 }
6162 }
6163 DW_MUTEX_UNLOCK;
6021 return retval; 6164 return retval;
6022 } 6165 }
6023 6166
6024 /* 6167 /*
6025 * Continues an existing query of a container. 6168 * Continues an existing query of a container.
6029 * return items that are currently selected. Otherwise 6172 * return items that are currently selected. Otherwise
6030 * it will return all records in the container. 6173 * it will return all records in the container.
6031 */ 6174 */
6032 char *dw_container_query_next(HWND handle, unsigned long flags) 6175 char *dw_container_query_next(HWND handle, unsigned long flags)
6033 { 6176 {
6177 GtkWidget *cont;
6178 GtkListStore *store = NULL;
6034 char *retval = NULL; 6179 char *retval = NULL;
6035 int _locked_by_me = FALSE; 6180 int _locked_by_me = FALSE;
6036 6181
6182 DW_MUTEX_LOCK;
6183 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
6184
6185 /* Make sure it is the correct tree type */
6186 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6187 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont));
6188
6189 if(store)
6190 {
6191 int pos = (int)g_object_get_data(G_OBJECT(cont), "_dw_querypos");
6192 int count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL);
6193
6194 /* These should be separate but right now this will work */
6195 if(flags & DW_CRA_SELECTED)
6196 {
6197 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(cont));
6198 GList *list = gtk_tree_selection_get_selected_rows(sel, NULL);
6199
6200 if(list)
6201 {
6202 GtkTreePath *path = g_list_nth_data(list, pos);
6203
6204 if(path)
6205 {
6206 gint *indices = gtk_tree_path_get_indices(path);
6207
6208 if(indices)
6209 {
6210 GtkTreeIter iter;
6211
6212 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, indices[0]))
6213 {
6214 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1);
6215 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1));
6216 }
6217 }
6218 }
6219 g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL);
6220 g_list_free(list);
6221 }
6222 }
6223 else if(flags & DW_CRA_CURSORED)
6224 {
6225 /* There will only be one item cursored,
6226 * retrieve it with dw_container_query_start()
6227 */
6228 retval = NULL;
6229 }
6230 else
6231 {
6232 GtkTreeIter iter;
6233
6234 if(pos < count && gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, pos))
6235 {
6236 gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &retval, -1);
6237 g_object_set_data(G_OBJECT(cont), "_dw_querypos", GINT_TO_POINTER(pos+1));
6238 }
6239 }
6240 }
6241 DW_MUTEX_UNLOCK;
6037 return retval; 6242 return retval;
6243 }
6244
6245 int _find_iter(GtkListStore *store, GtkTreeIter *iter, char *text)
6246 {
6247 int z, rows = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL);
6248 char *thistext;
6249
6250 for(z=0;z<rows;z++)
6251 {
6252 if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), iter, NULL, z))
6253 {
6254 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, 0, &thistext, -1);
6255 if(thistext == text)
6256 {
6257 return TRUE;
6258 }
6259 }
6260 }
6261 return FALSE;
6038 } 6262 }
6039 6263
6040 /* 6264 /*
6041 * Cursors the item with the text speficied, and scrolls to that item. 6265 * Cursors the item with the text speficied, and scrolls to that item.
6042 * Parameters: 6266 * Parameters:
6043 * handle: Handle to the window (widget) to be queried. 6267 * handle: Handle to the window (widget) to be queried.
6044 * text: Text usually returned by dw_container_query(). 6268 * text: Text usually returned by dw_container_query().
6045 */ 6269 */
6046 void dw_container_cursor(HWND handle, char *text) 6270 void dw_container_cursor(HWND handle, char *text)
6047 { 6271 {
6272 GtkWidget *cont;
6273 GtkListStore *store = NULL;
6274 int _locked_by_me = FALSE;
6275
6276 DW_MUTEX_LOCK;
6277 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
6278
6279 /* Make sure it is the correct tree type */
6280 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6281 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont));
6282
6283 if(store)
6284 {
6285 GtkTreeIter iter;
6286
6287 if(_find_iter(store, &iter, text))
6288 {
6289 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
6290
6291 if(path)
6292 {
6293 gtk_tree_view_row_activated(GTK_TREE_VIEW(cont), path, NULL);
6294 gtk_tree_path_free(path);
6295 }
6296 }
6297 }
6298 DW_MUTEX_UNLOCK;
6048 } 6299 }
6049 6300
6050 /* 6301 /*
6051 * Deletes the item with the text speficied. 6302 * Deletes the item with the text speficied.
6052 * Parameters: 6303 * Parameters:
6053 * handle: Handle to the window (widget). 6304 * handle: Handle to the window (widget).
6054 * text: Text usually returned by dw_container_query(). 6305 * text: Text usually returned by dw_container_query().
6055 */ 6306 */
6056 void dw_container_delete_row(HWND handle, char *text) 6307 void dw_container_delete_row(HWND handle, char *text)
6057 { 6308 {
6309 GtkWidget *cont;
6310 GtkListStore *store = NULL;
6311 int _locked_by_me = FALSE;
6312
6313 DW_MUTEX_LOCK;
6314 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
6315
6316 /* Make sure it is the correct tree type */
6317 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6318 store = (GtkListStore *)gtk_tree_view_get_model(GTK_TREE_VIEW(cont));
6319
6320 if(store)
6321 {
6322 GtkTreeIter iter;
6323 int rows = (int)g_object_get_data(G_OBJECT(cont), "_dw_rowcount");
6324
6325 if(_find_iter(store, &iter, text))
6326 {
6327 gtk_list_store_remove(store, &iter);
6328 rows--;
6329 }
6330
6331 g_object_set_data(G_OBJECT(cont), "_dw_rowcount", GINT_TO_POINTER(rows));
6332 }
6333 DW_MUTEX_UNLOCK;
6058 } 6334 }
6059 6335
6060 /* 6336 /*
6061 * Optimizes the column widths so that all data is visible. 6337 * Optimizes the column widths so that all data is visible.
6062 * Parameters: 6338 * Parameters:
6063 * handle: Handle to the window (widget) to be optimized. 6339 * handle: Handle to the window (widget) to be optimized.
6064 */ 6340 */
6065 void dw_container_optimize(HWND handle) 6341 void dw_container_optimize(HWND handle)
6066 { 6342 {
6343 GtkWidget *cont;
6344 int _locked_by_me = FALSE;
6345
6346 DW_MUTEX_LOCK;
6347 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
6348
6349 /* Make sure it is the correct tree type */
6350 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
6351 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(cont));
6352 DW_MUTEX_UNLOCK;
6353
6067 } 6354 }
6068 6355
6069 /* 6356 /*
6070 * Inserts an icon into the taskbar. 6357 * Inserts an icon into the taskbar.
6071 * Parameters: 6358 * Parameters: