They don’t really create the directory. They just turn on and off listening to them.
Archive for the ‘GTK’ Category
gconf_client_add_dir() and remove
5/8/2009 (quarta-feira)g_idle_add()
5/8/2009 (quarta-feira)When a signal is emitted a lot of times, and the processing of the action associated with the signal is expensive, it’s an option to only run the action when the system is idle. Using this function in this manner, this result can be achieved. I got to know this talking to pierlux in #champlain@irc.freenode.net and taking a look at champlain-marker.c from libchamplain. Thanks.
static gboolean scheduled; static gboolean run(gpointer user_data) { /* expensive code */ scheduled = FALSE; return FALSE; } static void on_event(GObject * object, gpointer user_data) { if(!scheduled) { scheduled = TRUE; g_idle_add(run, (gpointer) parameter_name); } } int main(int argc, char **argv) { /* initialization */ g_signal_connect(object, "event", G_CALLBACK(on_event), NULL); /* enter main loop */ }
Configuring Evolution after building from git
21/7/2009 (terça-feira)After building from git, the following command is necessary to avoid lock problems in local mail boxes, when evolution-data-server was built with –prefix=$dir and installed as a user.
# chown root:mail $dir/libexec/camel-lock-helper-1.2 # chmod ug+s $dir/libexec/camel-lock-helper-1.2
Adding an Accelerator to a GtkImageMenuItem in glade-3
21/7/2009 (terça-feira)To add an accelerator to a GtkImageMenuItem, you must:
- Create the accelerator for the signal in the GtkImageMenuItem: Common -> Accelerators.
- Create an accelerator group in the GtkImageMenuItem: General -> Accel Group
- Set the window to use this accelerator. In GtkWindow: General -> Accel Groups.
Rank 2 Types
27/6/2008 (sexta-feira)I’ve always seen the forall a
types in some GHC messages or in other person’s code, but I couldn’t get the point of it until I needed to use it myself. I was writing a Gtk2hs application with some windows, and I noticed that for each created window, I was doing the same steps. So I created a function that does what is needed for each function:
basic :: WidgetClass widget => String -> IO (Widget, (GObject -> Widget) -> String -> IO widget)
basic gladeFile = do (windowGlade :: GladeXML) <- getGlade gladeFile let windowGet :: Get windowGet = xmlGetWidget windowGlade (window :: Widget) <- windowGet castToWidget "window" (close :: Button) <- windowGet castToButton "close" onClicked close $ widgetDestroy window modifyIORef windows (window :) return (window, windowGet)
Notice that this code uses GHC extension PatternSignatures, which I like a lot.
The problem was that the returned function, windowGet
was not generalized enough, so I couldn’t use it with more than one type, even it being very general:
windowGet :: WidgetClass widget => (GObject -> widget) -> String -> IO widget
If I used it with, say, windowGet castToButton "ok"
and WindowGet castToSpinButton "value"
, it would give, in the seconde line, the type error: Couldn’t match expected type `Button’ against inferred type `SpinButton’.
After asking in #haskell, and reading a little bit of the GHC User’s Guide, I got the point. This was only possible with Rank 2 Types. windowGet must be:
windowGet :: forall widget. WidgetClass widget => (GObject -> widget) -> String -> IO widget
So I changed the type signature for basic
, and added Rank2Types to the LANGUAGE pragma, and it worked fine.
basic :: String -> IO (Widget, forall widget. WidgetClass widget => (GObject -> Widget) -> String -> IO widget)
Glade message dialog image …
27/6/2008 (sexta-feira)In a message dialog, when I click in the … of the Image field, I get a tree of Objects. I don’t understand hat this means, and I don’t know where to get documentation from it. This is Glade 3.4.5-3 in Debian lenny.
Glade-3 comboBox Active Item
27/6/2008 (sexta-feira)I don’t know if this is a known issue, but it seems strange to me that when I change the Active item value in the proprierties of a Combo Box in Glade 3, from -1 to any value, like 0 or 1, I have this message as soon as the glade file is loaded:
(test:5012): Gtk-CRITICAL **: gtk_tree_row_reference_new: assertion `GTK_IS_TREE_MODEL (model)' failed
(test:5012): Gtk-CRITICAL **: gtk_cell_view_set_displayed_row: assertion `GTK_IS_TREE_MODEL (cell_view->priv->model)' failed
And besides it, the Active Item keeps empty, and is not the first or second on the item list.
I’m using Glade-3 3.4.5 with libglade 2.6.2 in debian lenny.
Glade 3 with Message Dialog
26/6/2008 (quinta-feira)When a Message Dialog is created in Glade 3.4.5-3 (Debian sid and lenny), saved and re-opened, it crashes. More details: Bug in debian .
libwnck package for sid
20/6/2008 (sexta-feira)I’ve done a package for the correction of the libwnck bug to sid. It’s available at Debian Mentors and at my Home Page.
libwnck
16/6/2008 (segunda-feira)When XMonad was used with GNOME, through EwmhDesktops and the last window was destroyed, it would not be deleted from the window list and from the workspace switcher. This bug report explains the situation. To correct it, I’ve made a patch to libwnck’s screen.c
, which was applied in the SVN version of this file. I’ve done a package for Ubuntu Hardy Heron and other for Debian Etch with a corrected version of this library.