Skip to content

Instantly share code, notes, and snippets.

View ebassi's full-sized avatar

Emmanuele Bassi ebassi

View GitHub Profile
let context = widget.get_style_context();
let state = widget.get_state_flags();
context.save();
context.set_state(state);
padding = context.get_padding(context.get_state());
context.restore();
return padding;
00:32 <@ebassi> desrt: since you're working on GtkApplication, it'd be nice to have your thoughts on bug 722856
00:32 < Services> Bug http://bugzilla.gnome.org/show_bug.cgi?id=722856 normal, Normal, ---, gtkdev, UNCONFIRMED, API to
communicate loading state
00:32 < desrt> ebassi: saw that.... not sure i agree that gtkapplication has a role here.
00:32 <@ebassi> desrt: also to make up some sort of startup notification protocol for wayland
00:33 <@ebassi> desrt: well, we're centralising the application story into one class, so I'd say the Application class would
be well suited for that; also because it's the application that knows if a window is effectively ready to be
shown
00:34 < desrt> ebassi: but it's not about the application -- it's about the window
00:34 <@ebassi> but a GtkApplicationWindow method would also be enough, I guess
@ebassi
ebassi / git-ps1-bashrc.sh
Created May 9, 2012 10:38
enhancing __git_ps1 with a blacklist
# pretty hacky wrapper around __git_ps1 that checks directories in a blacklist
__git_maybe_ps1 ()
{
local fmt=''
if [ -z "${1-}" ]; then
fmt='(%s)'
else
fmt=${1}
fi
@ebassi
ebassi / getgrouplist
Created June 24, 2015 16:47
getgrouplist is a bad function, written by bad people
static gboolean
user_is_in_admin_group (uid_t user, const char *admin_group)
{
if (user == G_MAXUINT)
return FALSE;
if (admin_group == NULL || *admin_group == '\0')
admin_group = "wheel";
struct passwd *pw = getpwuid (user);
if (pw == NULL)
/* gtkwidget.h */
gboolean gtk_widget_get_visible (GtkWidget *w);
/* gtkwidget-private.h */
struct _GtkWidgetPrivate
{
...
};
#ifdef GTK_COMPILATION