Re: GtkGrid sets no expand with homogeneous

2014-04-02 Thread Takao Fujiwara

(04/02/14 20:43), Stefan Salewski-san wrote:

My guess is that you should set your buttons “expand” property to false.


The "expand" property does not effect if homogeneous is TRUE in my test.
And the "expand" property is FALSE in GtkWidget by default.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

GtkLockButton / GPermission

2014-04-02 Thread Roland Koebler
Hi,

is there any example for GtkLockButton (and/or GPermission)?
I'm trying to use it, but all I get are segfaults (in Python):

1. Adding a GtkLockButton and clicking on it segfaults:

$ python
>>> from gi.repository import Gtk
>>> w = Gtk.Window()
>>> b = Gtk.LockButton()
>>> w.add(b)
>>> w.show_all()
>>> Gtk.main()
(click)
Segmentation fault

2. Trying to use GSimplePermission segfaults:

$ python
>>> from gi.repository import Gio
>>> p = Gio.SimplePermission.new(True)
>>> p.acquire(None)
Segmentation fault

3. Using a GPermission-subclass works, but using it with the
GtkLockButton segfaults again:

$ python
>>> from gi.repository import Gio, Gtk
>>>
>>> class dummy_permission(Gio.Permission):
>>> def __init__(self):
>>> Gio.Permission.__init__(self)
>>> self.impl_update(False, True, True)
>>> def acquire(self, cancellable=None):
>>> self.impl_update(True, True, True)
>>> def release(self, cancellable=None):
>>> self.impl_update(False, True, True)
>>>
>>> p = dummy_permission()
>>> p.get_allowed()
False
>>> p.acquire()
>>> p.get_allowed()
True
>>> p.release()
>>> p.get_allowed()
False
>>> w = Gtk.Window()
>>> b = Gtk.LockButton()
>>> b.set_permission(p)
>>> w.add(b)
>>> w.show_all()
>>> Gtk.main()
(click)
Segmentation fault


Any ideas?

Roland
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkGrid sets no expand with homogeneous

2014-04-02 Thread Stefan Salewski
On Wed, 2014-04-02 at 19:40 +0900, Takao Fujiwara wrote:
> I'd like to port GtkTable to GtkGrid but my cells show big widths.

Have you considered this:

https://developer.gnome.org/gtk3/stable/GtkGrid.html

Description
GtkGrid is a container which arranges its child widgets in rows and
columns. It is a very similar to GtkTable and GtkBox, but it
consistently uses GtkWidget’s “margin” and “expand” properties instead
of custom child properties,

My guess is that you should set your buttons “expand” property to false.


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

GtkGrid sets no expand with homogeneous

2014-04-02 Thread Takao Fujiwara
I'd like to port GtkTable to GtkGrid but my cells show big widths.
I have no problem with GtkTable.
The following is the test code.
Could you help me to set no expanded cells with homogeneous in GtkGrid?

scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_size_request (scrolled, 300, 150);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
GTK_POLICY_NEVER,
GTK_POLICY_ALWAYS);
gtk_box_pack_start (GTK_BOX (priv->content_box), scrolled, FALSE, FALSE, 0);

viewport = gtk_viewport_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled), viewport);

#if GTK_CHECK_VERSION(3, 10, 0)
table = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (table), 0);
gtk_grid_set_column_spacing (GTK_GRID (table), 0);
gtk_grid_set_row_homogeneous (GTK_GRID (table), TRUE);
gtk_grid_set_column_homogeneous (GTK_GRID (table), TRUE);
gtk_container_add (GTK_CONTAINER (viewport), table);

for (i = 0; i < 12; i++) {
gchar *text = g_strdup_printf ("%d", i + 1);

row = i / 4;
col = i % 4;
button = gtk_button_new_with_label (text);
gtk_grid_attach (GTK_GRID (table), button,
  col, row, 1, 1);
g_free (text);
}
#else
table = gtk_table_new (row, col, TRUE);
gtk_table_set_row_spacings (GTK_TABLE (table), 0);
gtk_table_set_col_spacings (GTK_TABLE (table), 0);
gtk_container_add (GTK_CONTAINER (viewport), table);

for (i = 0; i < 12; i++) {
gchar *text = g_strdup_printf ("%d", i + 1);
GtkStyleContext *context;

row = i / 4;
col = i % 4;
button = gtk_button_new_with_label (text);
gtk_table_attach (GTK_TABLE (table), button,
  col, col + 1, row, row + 1,
  GTK_FILL, GTK_FILL, 0, 0);
}
#endif
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkPaned: visible handle?

2014-04-02 Thread Roland Koebler
Hi,

according to the documentation (and the image on
https://developer.gnome.org/gtk3/stable/GtkPaned.html),
GtkPaned-widgets have a visible handle (e.g. 4 dots)
to show that the user can drag this handle.

Unfortunately, these handles are invisible here -- both
in Glade and in the running program. Is there any way
to make them visible?

thanks,
Roland
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list