You are not logged in.
I've developed a gtk2 app (Conky Companion) in C to help users of my conky scripts
create their own conkyrcs with relative ease. A screenshot of the main screen is the following:
The user can drag and drop icons or labels from the right side to the left, move them, resize them, change their size or colour, etc. When happy, he can press the generate button and generate a conkyrc file.
The screen is a top,non resizable window with a table. The 2 sides of the table are frames in which fixed containers have been put.
Whenever someones tries to place an icon or a label at the right or bottom border of the left frame/fixed container, the widget goes off bounds, as you can see from the screen shot above.
I'm now trying to port the app to Gtk3 and I'm facing a bizarre problem.
Whenever a user tries to place or move an object to the right or bottom border of the left frame/fixed container, it resizes itself to accommodate the newly placed widget.
If I move the object to the left (or up), the frame goes back to its size defined by gtk_widget_set_size_request.
Is there a way to make a fixed container... fixed? I don't want it to resize.
The code that places the frame and the fixed container in the window is this:
/* LEFT FRAME */
frame1= gtk_frame_new(NULL);
gtk_table_attach(GTK_TABLE(table), frame1, 0,14,0,49,GTK_SHRINK,GTK_SHRINK,0,0);
gtk_widget_set_size_request(frame1, 360,570);
gtk_widget_show(frame1);
/* LEFT FRAME - FIXED CONTAINER */
fixed1 = gtk_fixed_new();
gtk_widget_set_has_window(fixed1,TRUE);
gtk_container_add(GTK_CONTAINER(frame1),fixed1);
gtk_widget_modify_bg (fixed1, GTK_STATE_NORMAL, &color);
gtk_drag_dest_set (
fixed1, GTK_DEST_DEFAULT_ALL,
target_list, 1, GDK_ACTION_COPY|GDK_ACTION_MOVE);
g_signal_connect (fixed1, "drag-drop",G_CALLBACK (dr_data_rec_1d1), (gpointer)fixed1);
gtk_widget_show(fixed1);
I've tried the following things:
1)Fiddling with GTK_EXPAND and GTK_FILL for the placement of the frame. No change.
2)gtk_window_set_geometry_hints for the window, table, frame and fixed container. No change.
3)Replacing gtk_table with gtk_grid. No change.
After posting on StackOverflow, I was advised to consult the following page
http://developer.gnome.org/gtk3/3.2/ch2 … #id1482126
which I did. If I understood correctly, the new way of declaring
/* LEFT FRAME */
frame1= gtk_frame_new(NULL);
gtk_table_attach(GTK_TABLE(table), frame1, 0,14,0,49,GTK_SHRINK,GTK_SHRINK,0,0);
gtk_widget_set_size_request(frame1, 360,570);
is (ignore the height for the time being)
static void
my_widget_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
gint *natural_width)
{
GtkRequisition requisition;
gtk_widget_get_requisition (widget, &requisition);
*minimal_width = *natural_width = requisition.width;
}
....
/* LEFT FRAME */
frame1= gtk_frame_new(NULL);
gtk_table_attach(GTK_TABLE(table), frame1, 0,14,0,49,GTK_SHRINK,GTK_SHRINK,0,0);
gint min_width=360;
gint nat_width=360;
GTK_WIDGET_GET_CLASS(frame1)->get_preferred_width=my_widget_get_preferred_width;
my_widget_get_preferred_width(frame1,&min_width,&nat_width);
It compiles OK, but, when run, it gives me this error:
(conky_companion:19700): Gtk-WARNING **: GtkFrame 0xa00e660: widget tried to gtk_widget_get_width inside GtkWidget ::get_width implementation.
without ever drawing the window and it segfaults after a while.
What am I missing here?
Or, TL;DR, what is the equivalent of
gtk_widget_set_size_request(frame1, 360,570);
in gtk3? (StackOverflow gave up, you're my last hope)
Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux!
Offline
Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux! Please make Autocad Civil 3d and Archicad work on Linux!
Offline