Re: GModule
Am Sonntag, den 28.01.2007, 23:30 -0500 schrieb Jordan Walsh: Why don't you use a hash table to map all symbols to their GModules after calling g_module_symbol()? > Hi all. I need to be able to see from what library (using GModule) a > certain > symbol comes from. In my main program when a plugin unloads I need to > be > able to de-reference any pointers to its functions. I cannot however > seem to > figure out how to see what module that function resides in. Thanks. > -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Key-value file parser, howto get all groups and create loop from them
Am Dienstag, den 01.08.2006, 19:12 +0200 schrieb rupert: > Im so far with my code that i want to create a table where each group > gets a row that has labels, buttons and textentries. > right now im using a GtkTable where i create the Widgets in the for > loop that gets the content from the keyfile, is this possible or do I > have to use a treeview? No, unfortunately there is currently no button implementation for tree views, at least none I know of. > I can compile the app but get a segfault while running, it looks like > this with one static row http://az-lantech.de/ubuntu/view.png. Without seeing your code, we can't really help you. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Key-value file parser, howto get all groups and create loop from them
Am Dienstag, den 01.08.2006, 19:12 +0200 schrieb rupert: > > after some more playing arround i got the things good working, the > reference helps often, i have away from programming some time and > never been to deep in, so sometimes i do things wrong that other > wouldnt. > Im so far with my code that i want to create a table where each > group gets a row that has labels, buttons and textentries. > right now im using a GtkTable where i create the Widgets in the for > loop that gets the content from the keyfile, is this possible or do I > have to use a treeview? C is quite error-prone, so unless you understand each line you are writing you shouldn't use it. People using Python on a day-to-day basis claim that it's way more suitable for writing robust code and much more simple to learn. If I'm taken right, you can easily create lists, hash tables and the like with python, and concentrate on the semantics instead of having to care about memory that has to be freed. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Key-value file parser, howto get all groups and create loop from them
Am Dienstag, den 01.08.2006, 12:52 +0200 schrieb rupert: > Im playing arroung with the Gkeyfile functions and now try to get all groups > from the keyfile and create a for loop that than shows me the > different values, packed into strings, including the group name > i have something like this in mind: > > crpyto_get_keyfile(){ > >GtkWidget *crypto_keys, *crypto_key_groups; > gboolean *isfile=FALSE; > gchar *startgroup; > gint *groupcounter=0; Why did you make crypto_key_groups and crypto_keys a GtkWidget, and use pointers for all the variables? Maybe learning C before learning the GTK +/GLib API would help? :) > crypto_keys = g_key_file_new(); > g_key_file_load_from_file(crypto_keys, > "/home/Programmierung/GTK_Projects/project_dmaster/src/crypto.ini", > G_KEY_FILE_NONE, NULL) ; > > crypto_key_groups = g_key_file_get_groups(crypto_keys, NULL); > > // g_print("%s", crypto_key_groups[0]); > //startgroup = g_key_file_get_start_group(crypto_keys); So far, so good (except for the variable types, see below). > while (g_key_file_get_groups(crypto_keys, NULL)) > { > > crypto_key_groups[groupcounter] = g_key_file_get_groups(crypto_keys, > NULL); > // g_key_file_get_string(crypto_keys, "DATEN", "mountpoint", NULL); > g_print("%s", g_key_file_get_string(crypto_keys, "DATEN", > "mountpoint", NULL)); > } > > } Please read the g_key_file_get_groups() documentation, this won't work. char **crypto_key_groups; int i; crypto_key_groups = g_key_file_get_groups (crypto_keys, NULL); for (i = 0; crypto_key_groups[i] != NULL; i++) { g_print("%s", g_key_file_get_string(crypto_keys, crypto_key_groups[i], "mountpoint", NULL)); } g_strfreev (crypto_key_groups); note that this code will execute the for-enclosed block for each group. But maybe you just want to fetch the "mountpoint" key's value from the "DATEN" group? If so, you should use g_print ("%s", g_key_file_get_string(crypto_keys, "DATEN", "mountpoint", NULL)); Maybe I'm taken wrong but I think the GKeyFile API and documentation is quite strong and obvious. If you disagree, please tell us what particular problem you encountered. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: use a picture and a label as gtk_notebook_tab_label
Am Samstag, den 22.07.2006, 17:07 +0200 schrieb rupert: > Im trying to use an image and a gtk_label as a tab_label. > I pack both into a hbox and put this hbox as the tablabel in the append_page > option: > > [code] > mainbook = gtk_notebook_new (); > gtk_box_pack_start(GTK_BOX (vboxmain), mainbook, TRUE, TRUE, 0); > gtk_notebook_set_tab_pos (GTK_NOTEBOOK (mainbook), GTK_POS_TOP); > gtk_widget_show (mainbook); > > > book_samba = gtk_label_new ("SAMBA"); > image1 = g_object_new(GTK_TYPE_IMAGE,"file", "pics/ledred.png", NULL); > samba_hbox = gtk_hbox_new(FALSE, 0); > gtk_widget_show(samba_hbox); > gtk_box_pack_start(GTK_BOX(samba_hbox), book_samba, TRUE, TRUE, 0); > gtk_box_pack_start(GTK_BOX(samba_hbox), image1, TRUE, TRUE, 0) > > gtk_notebook_append_page(mainbook, vbox1, samba_hbox); > > [/code] > > so what am I doing wrong, i also tried gtk_container_add() with the > same(none) result. Try calling gtk_widget_show() on the label and the image, or gtk_widget_show_all() on the hbox. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: float params of a gobject
Am Montag, den 10.07.2006, 12:45 -0300 schrieb Daniel Alonso: > Hi, I'm trying to define a gobject class with a floating number > property. In the init class procedure I define the property the > following way: > > param_spec = g_param_spec_float > ("width" /* name */, >_("Icon Width") /* nick */, >_("The width of the svg icon") /* blurb */, >G_MINFLOAT /* minimum */, >G_MAXFLOAT /* maximum */, >0.0 /* default_value */, >(GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE)); > g_object_class_install_property (g_object_class, > PROP_WIDTH, > param_spec); > > This compiles fine, but when running the test program it raises a glib > exception: > > (test:5073): GLib-GObject-CRITICAL **: g_param_spec_float: assertion > `default_value >= minimum && default_value <= maximum' failed > > (test:5073): GLib-GObject-CRITICAL **: g_object_class_install_property: > assertion `G_IS_PARAM_SPEC (pspec)' failed > > But default value 0.0 is equal G_MINFLOAT and lesser than G_MAXFLOAT, > isn't it? >From the API docs [1]: "The minimum positive value which can be held in a gfloat. If you are interested in the smallest value which can be held in a gfloat, use -G_MAX_FLOAT." 0.0 is not considered positive in this case, I think it works like: G_MINFLOAT is the smalles floating number f that satisfies f > 0. Since icons may only have a positive width, 1.0 might be a good default value. [1] http://developer.gnome.org/doc/API/2.0/glib/glib-Limits-of-Basic-Types.html#G-MINFLOAT:CAPS"; -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: "Failed to open file 'Hp\u0008\u0008': No such file or directory."
Am Donnerstag, den 01.06.2006, 15:51 +0200 schrieb Stefano Esposito: > > this code gives me the error from the subject (or someone equivalent). > Any hint would be greatly appreciated. > ... > int open_file (gchar *fname, gchar *text) > { > /*fname is the return value of gtk_file_chooser_get_filename, used > on a gtk_file_chooser_dialog*/ > GError *error = NULL; > gchar *tmp_text; > > if (!g_file_get_contents (glib_fname, &tmp_text, NULL, &error)) Where does glib_fname come from? Maybe it is a static or a global variable declared outside the function? Maybe you could also post the lines before the open_file invocation? > { > g_warning ("%s. File not red", error->message); > return 0; > } > > if(!g_utf8_validate (tmp_text, -1, NULL)) > { > text = g_locale_to_utf8 (tmp_text, -1, NULL, NULL, &error); > if (error != NULL) > { > g_warning ("%s. File not red", error->message); > return 0; > } > } > else > { > text = tmp_text; > } > return 1; > } -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to detect if a glist->data is a GUINT_TO_POINTER for not freeing it ?
Am Freitag, den 21.04.2006, 13:01 +0200 schrieb Colossus: > Enrico Tröger wrote: > > No, it is a simple decimal value. I appended the l to emphasise that it > > is a long int. I'm not completely sure, but I think you can safely omit > > it. Why don't you use two lists instead of one? Same number of mallocs, just one pointer more to pass around. GList *nbr; GList *str; nbr = str = NULL; for (i = 0; mydatasource[i] != NULL; i++) { nbr = g_list_prepend (nbr, GUINT_TO_POINTER (mydatasource[i].myint)); str = g_list_prepend (str, g_strdup (mydatasource[i].mystr)); } nbr = g_list_reverse (nbr); str = g_list_reverse (str); fill_store (nbr, str); Another alternative for encapsulating two data types would be typedef struct { enum { LIST_DATA_STRING, LIST_DATA_NUMBER } data_type; union { char *mystr; guint64 mynum; } data; } MyListData; You'd do list_data = g_new (MyListData, 1); if (isstr) { list_data->data_type = LIST_DATA_STRING; list_data->data.mystr = g_strdup (mystr); } else { list_data->data_type = LIST_DATA_NUMBER; list_data->data.mynum = myint; } list = g_list_prepend (list, list_data); Note that this may cause some malloc overhead for many entries. It would be simpler if you described what you want to achieve with these two data types. There is definitly a better solution than stuffing everything into one single GList. > This is my code: > original = g_strndup ( start , end - start); > unsigned long long int *_original = g_malloc(sizeof(unsigned long long > int)); > *_original = atoll (original); > g_free (original); > > later I fill the GList: > archive->row = g_list_prepend (archive->row , _original) ; > > Then in another file.c I have to fill the liststore by retrieving the > values from the GList: > > gtk_list_store_set(GTK_LIST_STORE(list_store), &iter, i, fields->data, > -1); > > And in this line I get the segfault ! Obviously I declared that column > as G_TYPE_UINT64; > > It's related to the allocated u long long int pointer because if I use > GUINT_TO_POINTER with G_TYPE_UINT it works. Do you have any idea about > the crash ? Shouldn't you use GPOINTER_TO_UINT(fields->data)? I'm also curious why you use i, i.e. a running variable. How does your list store look? -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Random Number of Buttons
Am Donnerstag, den 20.04.2006, 05:02 -0700 schrieb 3saul: > I'm wanting to know the best way to declare a random number of buttons > for my > gtk app. The number will changed depending on the argument passed to > my app. How do you want to arrange them, and what should they contain? -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Insert image in Scrolled window
Am Donnerstag, den 30.03.2006, 10:47 -0800 schrieb Sandeep KS: > >I have a ScrolledWindow inside the main window and I have > inserted some images in the main window and i need to insert some > images inside the scrolled window also. Is it possible to insert > images inside ScrolledWindow? > > I tried to insert images using gtk_fixed_put(), but it didnt work.. > So please give me some suggestions If you just want an image in a scrolled window, you can use gtk_scrolled_window_add_with_viewport (win, image); where image is a widget of type GtkImage. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Question about gtk_file_selection_new
Am Sonntag, den 19.03.2006, 11:44 +0100 schrieb [EMAIL PROTECTED]: > > is there a way to make file selection dialog box created with > gtk_file_selection_new > also display hidden files?? gtk_file_chooser_set_show_hidden. I wonder why you need this, though. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: mapping keys to functions
Am Donnerstag, den 02.03.2006, 17:23 -0600 schrieb Matt Hull: > is it possible to get an integer from a key press ? are there any > standard integers for common keys ? like enter, arrowup ? > > working on a game and want the user to be able to map keys to > functions > using an array. seems like the keys are enumerated. Keyboard-related events are handled by GdkEventKey structures, which inter alia provide a keyval, which is an unsigned integer. contains the relevant #defines. If you also want to check which modifiers were pressed (shift, alt etc.) you'll have to query the state member in the GdkEventKey struct. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: clipboards under win32
Am Samstag, den 25.02.2006, 09:30 +1100 schrieb Nick Watts: > (application.exe:612): GLib-GObject-CRITICAL **: gtype.c:2254: > initialization asser > tion failed, use g_type_init() prior to this function Are you sure that you called gtk_init (&argc, &argv); before using GObject? -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: dealing with utf8 filenames
Am Mittwoch, den 22.02.2006, 08:17 -0800 schrieb Alan M. Evans: > On Wed, 2006-02-22 at 07:59, Christian Neumair wrote: > > Am Mittwoch, den 22.02.2006, 07:09 -0800 schrieb Alan M. Evans: > > > On Tue, 2006-02-21 at 16:25, Tor Lillqvist wrote: > > > > > Also, I don't think the string returned from g_utf8_casefold() is > > > > > guaranteed to be the same length as the original, so my calculation > > > > > for string length is incorrect. > > > > > > > > Umm, no? You look at the casefolded string and calculate the length of > > > > the part up to the '.' of that? > > > > > > Yes, that's what I'm doing. No, I don't think it's correct. > > > > You can perfectly do pointer arithmetic with UTF-8 encoded strings. > > I don't have a problem with pointer arithmetic. My problem is that I'm > doing arithmetic on one string (the case-folded version) and applying > that math to another string (the original version). This can only be > correct if the two strings are the same length in bytes. I don't believe > that's a sure thing with UTF-8. Yes, I think that is correct. > > For the sake of readability, I'd rather use the following code: > > > > char **str; > > > > /* str[0]: basename > >str[1]: extension */ > > str = g_strsplit (filename, ".", 2); > > > > g_strfreev(str) > > Surely that won't work if there is more than one dot in the name! Why? :) -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: clearing gtkliststore and gtktreestore
Am Donnerstag, den 16.02.2006, 14:18 -0500 schrieb devel: > I'm having problems with clearing a treestore and a liststore. > gtk_list_store_clear() and gtk_tree_store_clear() are clearing the > lists visually (can see this in the GUI, obviously), but appear to be > leaving "copies" behind and my memory is being sucked dry. I was going > to try a memory leak tester to help me out, but I'm currently > developing this app for windows and can't seem to find a tester for > windows. I suppose you're using gtk_list_store_set (store, &iter, STR_COLUMN, g_strdup (mystr), -1); Please don't dup the data yourself, GTK+ will do this for you based on the column type by calling the appropriate duplication routines. If you want to insert complex data, either use GObjects (these will be unrefed when they're removed from the model), or use plain structs and subclass G_TYPE_BOXED. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Application structuring with threads & network I/O - suggestions?
Am Freitag, den 17.02.2006, 22:04 -0500 schrieb Gorshkov: > I'm developing an small network application as a test case before I go on to > my main app - I want to make my mistakes on something small & manageable. > [...] Unfortunately, we can't do much about it without having seen code. My suspicion is that you just proved that C is error prone. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: dealing with utf8 filenames
Am Mittwoch, den 22.02.2006, 07:09 -0800 schrieb Alan M. Evans: > On Tue, 2006-02-21 at 16:25, Tor Lillqvist wrote: > > > Also, I don't think the string returned from g_utf8_casefold() is > > > guaranteed to be the same length as the original, so my calculation > > > for string length is incorrect. > > > > Umm, no? You look at the casefolded string and calculate the length of > > the part up to the '.' of that? > > Yes, that's what I'm doing. No, I don't think it's correct. You can perfectly do pointer arithmetic with UTF-8 encoded strings. For the sake of readability, I'd rather use the following code: char **str; /* str[0]: basename str[1]: extension */ str = g_strsplit (filename, ".", 2); g_strfreev(str) -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Not receiving input w/ multiple renderers in a TreeViewColumn
Am Mittwoch, den 22.02.2006, 01:48 -0600 schrieb Gabriel Burt: > In F-Spot we have a TreeView for showing all the tags. It has three > columns: a checkbox, an icon, and a name. > > I'm trying to put all three of these renderers into one column so the > hierarchy will expand nicer (instead of the icon/name of a child lined > up with those of it's parent). > > When I do that (put all the renderers into one column), if I click the > checkbox when I already have that tag's row selected, it toggles just > fine. > > But when I try to click the checkbox without having the row selected > (highlighted) first, instead of toggling and selecting that row it > only > selects the row. This sounds like a bug. I'm not aware of any other application doing similar things, some menu editors use checkboxes, but don't pack them into one column together with other cell renderes. Maybe you could come up with a little C testcase and file a bug report? -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Using: g_key_file_load_from_file() in homedir
Am Mittwoch, den 22.02.2006, 19:52 +0530 schrieb Santhosh: > > > everything works, but when changing the path to > "~/.DiamondBOX/Diamond.settings" > > I think "~/..." is converted to "home-dir" by the shell.. it may not > be supported by the GLIB API... > > Instead you can use glib functions to get the home directory... I > couldn't exactly recall the function... it could be > "g_...get_homedir()" char *path; path = g_build_filename (g_get_home_dir (), ".DiamondBOX/Diamond.settings", NULL); /* GKeyFileCode ... */ g_free (path); -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Using: gtk_button_set_image() gives small empty buttons
Am Mittwoch, den 22.02.2006, 12:45 +0100 schrieb Nikolaj Kiær Thygesen: > GtkWidget *button = gtk_button_new(); > gtk_button_set_image(GTK_BUTTON(button), > gtk_image_new_from_file(filename)); > gtk_widget_show(button); > > I can display the "gtk_image_new_from_file(filename)" widget on its > own, and it does contain my image (I've tried both line-art and > grey-scale images), but when "gtk_button_set_image()"-ing the image to > my button I get a silly little button probably about 5x5 pixels in > size with no image within!? gtk_widget_show_all (button); /* might help. */ -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: scientific widgets developing
Alexandre wrote: Hi, i'm begining to write technical widgets for gtk, like termometer, compass, dials.. I want to know if is there something done in this area.. and someone interested. This kind of specialized widget library is always appreciated, since it can be heavily reused! You may want to arrange your code so that they are in a separate source directory, ready to be split out into a separate library package once people actually demand them, which heavily depends on the quality of the widgets. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
RE: gdk_display_set_double_click_time: has no effect
Am Freitag, den 20.01.2006, 15:22 -0600 schrieb Boncek, John: > We are not tinkering. We have an embedded app with no other apps in > the > system and no desktop. We cannot afford a user interface for many > settings such as this. So what is required to get > gdk_display_set_double_click_time to work? Please refer to [1]. You'll have to modify your "gtk-double-click-time" GtkSetting. [1] http://mail.gnome.org/archives/gtk-devel-list/2004-September/msg00061.html -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: colors in treeview
Karel Honzl wrote: Is it possible to create treeview in which I can set color (text color) of certain row? I want to hightlight some rows. You may want to take a look at the way GtkCellRenderers [1] work. Before rendering a particular row, your tree view sets the attributes registered with gtk_tree_view_insert_column_with_attributes on the cell renderer based on the column data you specified, afterwards requesting a render. The properties not registered with the GtkTreeView are used for rendering but not modified by the tree view. For instance for getting bold text, you can set the "weight" attribute of the cell renderer to PANGO_WEIGHT_BOLD, and add a new boolean column to your model which is passed as "weight-set" attribute column inside the treeview registration call. If you don't want to mess around with additional columns, and your "weight-set" value depends on the state of some object, you can also use gtk_tree_view_insert_column_with_data_func for the column and manually set all the attributes based on the object state. [1] http://developer.gnome.org/doc/API/2.0/gtk/GtkCellRendererText.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Blocking a signal with unknown handler id?
Daniel Pekelharing wrote: Hi all, Anyone know how one would go about blocking a signal on a widget where you don't know the signal handler id? I have some check menu items which I set depending on various program modes... I need to block the "activate" signal before I set it and unblock it afterwords, but I don't know the id... Is there perhaps someway to block all user defined callbacks on a widget? Thanks! You may want to try g_signal_lookup and g_signal_handlers_block_matched where only G_SIGNAL_MATCH_ID is passed. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Problems with gconf
Am Freitag, den 06.01.2006, 14:07 -0300 schrieb Arx Henrique: > > I'm trying to get some values from gconf, but when i try execute my > program always throw a segmentation fault, anyone can show me where's > i'm fault? Please provide some of the relevant GConf client code, else we won't be able to help you. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Clear a text combo box
Am Donnerstag, den 05.01.2006, 16:34 -0300 schrieb Juan Pablo: > What is the way for removing all items in a combo box? > If it is iterating gtk_combo_box_remove, how do i get the number of > items it has? You'll have to peek the combo box model data. You can fetch the model using gtk_combo_box_get_model and either use gtk_list_store_clear, or gtk_tree_model_iter_n_children and gtk_combo_box_remove_text. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk support for threading
Am Donnerstag, den 05.01.2006, 15:24 +0530 schrieb sadhees kumar: > Hi Friends, > > I have created my GTK application , and implemented > threading with Pthread.It is working fine in Host (Pentium 3). Screen is not > displayed in the Target(ARM9). > > Is GTK is fully supporting threading? > > I am using GTK version 2.2.4. > > Thanks is advance... Please refer to http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How invoke a menu and menu items on key press
Am Mittwoch, den 04.01.2006, 23:09 -0800 schrieb Suresh Stephen: > > I need to know how to add a shortcut key for a menu so that > i can invoke that menu by pressing alt+ and |||ly for > menu items also so when the menu is pooped i just want to press a key > and invoke a functionality also i want to know how u can underline > that a letter in the menu item name which we set as the short cut key. > > For example: > a menu has a menu item exit i want 'x' to be its shortcut key > and 'x' must be underlined > Any help in this regard would be gr8 You can assign a mnemonic to an arbitrary menu item by using gtk_menu_item_new_with_mnemonic and passing "_Foo" instead of "Foo" as item label. The letter after '_' will be used as mnemonic. If you use GtkActions (recommended), the label field of your GtkActionEntry should be set to "_Foo". -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Fwd: Catch signal
Am Mittwoch, den 04.01.2006, 14:13 -0600 schrieb Daniel Espinosa: > -- Forwarded message -- > From: Daniel Espinosa <[EMAIL PROTECTED]> > Date: 04-ene-2006 14:12 > Subject: Re: Catch signal > To: Fernando Apesteguía <[EMAIL PROTECTED]> > > Yes I think. > > You may need a interprocess comunication, like D-BUS see: > > http://www.freedesktop.org/wiki/Software_2fdbus The traditional UNIX way of solving this is using sockets. [1] gives a nice introduction, although it uses Python. [1] http://www.amk.ca/python/howto/sockets/ > 2006/1/4, Fernando Apesteguía < [EMAIL PROTECTED]>: > > > > Hi, > > > > I've developed an app test to catch a delete_event for a window so I can > > show some messages and then depending on the user answer close or not the > > window. > > > > My question is if there is a way to handle this signal from an external > > application. This is The application B detects when the delete event > > has > > been sent to the application A. > > > > Is this possible? -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Change the behaviour of a button
Am Montag, den 26.12.2005, 13:15 +0300 schrieb Yury Aliaev: > >> I'm sure there's a "right way" but if you're in a hurry you can do > >> something I've used successfully. Use a table to lay out your objects, > >> and pack two buttons into the same cell. Hide one. When you need to > >> show the Stop button, hide the Remove button and show the Stop button. > >> It works very well for me. > > > > > > Thanks. > > GtkTables are good. > > I guess I should use gtk_widget_show() and gtk_widget_hide() to > > hide/unhide the buttons... > > Naturally. You even can use GtkBox instead of GtkTable and pack all four > widgets (two images and two labels) in it, and then pack this box into > the button and show necessary and hide unnecessary widgets using > gtk_widget_show()/gtk_widget_hide() functions. I recommend against this since it will break the GUI for people who disable images on buttons. You should rather pack both buttons into one box (hbox or vbox), use the suggested show/hide code and use a GtkSizeGroup which ensures that both always have the same size. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: A Question about GtkTreeSortable
Am Donnerstag, den 20.10.2005, 17:44 +0200 schrieb Iago Rubio: > On Thu, 2005-10-20 at 19:06 +0800, searun wrote: > > Hi , > > > > Now i want to use GtkTreeSortable to sort a list. The first entry in the > > gtk_tree_view is an information entry which needn't to be sorted, so i don't > > want the GtkTreeIterCompareFunc function use the first entry. In my programe > > i check GtkTreeIter, if it is the same as the first iter, the > > GtkTreeIterCompareFunc will return 0. > > How are you comparing those iters ? > > > BUT it can't work. After two day's debug, i can't find the reason. > > > > Any help is appreciated, even if you have another good method. > > Try to compare the paths with gtk_tree_path_compare() instead of > comparing the iters. I don't know a generic function to compare iters. > > gint > your_tree_iter_compare_func (GtkTreeModel *model, > GtkTreeIter *a, > GtkTreeIter *b, > gpointer user_data) > { > GtkTreePath* path_first; > GtkTreePath* path_a; > GtkTreePath* path_b; > > first_path = gtk_tree_path_new_first(); > path_a = gtk_tree_model_get_path (model,a); > path_b = gtk_tree_model_get_path (model,b); > > if( gtk_tree_path_compare(path_first, path_a) == 0 ){ > return -1; // "a" is first so "a" always sorts before > }else if ( gtk_tree_path_compare(path_first, path_b) == 0 ){ > return 1; // "b" is first so "a" always sorts after > } > > // none of both are first so compare them > > ..... > > gtk_tree_path_free(path_first); > gtk_tree_path_free(path_a); > gtk_tree_path_free(path_b); > } Note that this will IMHO only work if the informal row is inserted into the model before any other row. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: A Question about GtkTreeSortable
Am Donnerstag, den 20.10.2005, 19:06 +0800 schrieb searun: > Hi , > > Now i want to use GtkTreeSortable to sort a list. The first entry in the > gtk_tree_view is an information entry which needn't to be sorted, so i don't > want the GtkTreeIterCompareFunc function use the first entry. In my programe > i check GtkTreeIter, if it is the same as the first iter, the > GtkTreeIterCompareFunc will return 0. > BUT it can't work. After two day's debug, i can't find the reason. > > Any help is appreciated, even if you have another good method. Returning 0 is wrong here, because it denotes that both elements are equal, and no sorting will take place for this element. Rather use: static int my_cmp_func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, MyType *first_element) { MyType *element_a, *element_b; gtk_tree_model_get (model, a, MY_ELEMENT_COLUMN, &element_a, NULL); gtk_tree_model_get (model, b, MY_ELEMENT_COLUMN, &element_b, NULL); if (element_a == element_b) { return 0; } if (element_a == first_element) { return -1; } if (element_b == first_element) { return 1; } /* other sorting */ } -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Building interfaces in GTK: apart GLADE ??
Tristan Van Berkom schrieb: If you must have generated code, I dont see whats wrong with the code that glade generates (if its simply unmaintained in glade-2; I'm not aware of that, better ask on [EMAIL PROTECTED]). See Owen Taylor's quoted statement on generated code [1]. All the points he made are still valid. There is no reason to use generated code. glade has autoconnection capabilities, meaning that you can specifiy "foo_cb" in the glade file as a handler for an event (i.e. a signal emission), define foo_cb in your code and it will magically be invoked when the signal is emitted. [2] has an example showing how simple it is to build a RAD GUI. [1] http://lists.ximian.com/pipermail/glade-devel/2003-March/29.html [2] http://developer.gnome.org/doc/API/2.0/libglade/libglade-notes.html ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: First column header in GtkTreeView?
Am Montag, den 03.10.2005, 16:30 +0200 schrieb The Saltydog: > On 10/2/05, Christian Neumair <[EMAIL PROTECTED]> wrote: > > Maybe you should create two GtkTreeViews that share one model and pack > > both into scrolled windows with different scroll policies. These two > > scrolled windows should then be packed into one hbox. Good luck! :) > > The problem is that I want just 2 scrollbars, not 4. And I I remove > scrollbars on first window (attribute = never) it will always spread > to its maximum size... gtk_scrolled_window_set_policy allows you to set a separate policy for horizontal and vertical scrolling. Using this together with gtk_tree_view_column_set_resizable should do the trick. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: First column header in GtkTreeView?
Am Sonntag, den 02.10.2005, 20:58 +0200 schrieb The Saltydog: > On 10/1/05, The Saltydog <[EMAIL PROTECTED]> wrote: > > On 10/1/05, Christian Neumair <[EMAIL PROTECTED]> wrote: > > > > > > Do you want to arrange that your tree view does no horizontal scrolling > > > at all, or that only the second column scrolls? > > > > No, I need horizontal scrolling, but the first column must be fixed as > > an header. The treeview should scroll from the second. > > > > .. a sort of "double header", one horizontal and the other one vertical.. Maybe you should create two GtkTreeViews that share one model and pack both into scrolled windows with different scroll policies. These two scrolled windows should then be packed into one hbox. Good luck! :) -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkExpander and resizeable dialogs
Am Sonntag, den 02.10.2005, 14:38 +0100 schrieb Luke Biddell: > I am using a GtkExpander in a GtkDialog and I'm having problems with > the dialog sizing. Once the expander has been expanded, I can't get > the dialog to shrink back to it's original size unless I set the > dialog to be non-resizeable. > > I've tried calling gtk_window_resize on the dialog and passing in the > original size when I get the expanded signal. That doesn't work. > > It seems to me that the dialog's minimum size is being changed as I > can force the size back to the original size using > gtk_widget_set_size_request. However, doing this means I've got to > manage all the window sizes so if a user resizes the dialog, > everything works. > > Does anyone have any experience of this? I don't want to make my > dialog non-resizeable but it seems the only way to get GtkExpander to > work properly. I suppose that your WM prevents you from manually setting the window size once the window is mapped. Metacity IMHO does this, for instance. I have no clue why this limitation is imposed, probably some apps did really bad things. Maybe you can gtk_window_set_resizable the window to FALSE and re-set it to be resizable once it shrunk. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: First column header in GtkTreeView?
Am Freitag, den 30.09.2005, 21:50 +0200 schrieb The Saltydog: > Is there any way to have the first column fixed in a GtkTreeView, not > scrolling to the left? I need to headers: the first row and the first > column... Do you want to arrange that your tree view does no horizontal scrolling at all, or that only the second column scrolls? -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Scaling in one direction
Am Samstag, den 01.10.2005, 09:40 +0930 schrieb Lachlan Gunn: > Hi, > I'm making an application that has a vbox that I want to only resize > horizontally gtk_widget_set_size_request (-1, desired_vertical_size_in_px); -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkTreeView Search Popup
Am Donnerstag, den 29.09.2005, 12:46 -0400 schrieb Alex Levin: > Hello. I have an application which has a very specific UI built into > it. I have a GtkTreeView widget in which I would like to enable the > typeahead search functionality. My problem is that if I use the > gtk_tree_view_set_enable_search function, a popup box with the letter > typed is displayed. Does anyone know of any way to enable the > functionality but disable the popup? Thanks in advance. I don't think this is trivially possible. As soon as the popup is created, it gets all the key events. No popup, no completion. While I really wonder what the purpose of this inconsistency wrt other GTK+ applications is, you can still do what Nautilus 2.12 does [1] (2.14 hopefully won't!) and keep around your custom typeahead buffer. [1] http://cvs.gnome.org/viewcvs/nautilus/src/file-manager/fm-list-view.c?r1=1.216&r2=1.217 -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Memory question
Am Donnerstag, den 29.09.2005, 13:39 +0200 schrieb Przemysław Sitek: > Dnia 2005-09-29 21:41, Colossus napisał: > > Ok, > > > > the correct way is to cast g_strerror to (char *): > > > > response = ShowGtkMessageDialog (GTK_WINDOW > > (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,(char *) > > g_strerror(errno)); > > > > This way i don't get any warning. > > But it's still incorrect. It should be > > response = ShowGtkMessageDialog (GTK_WINDOW > (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK, > "%s", g_strerror(errno)); > > printf-like functions shouldn't take random strings as their format > string, as they may contain format instructions (such as %s, %d etc) > which will cause the function to look for non-existent arguments which > will produce segfauls. I wasn't aware that the called method has printf flavor. I wonder which API provides ShowGtkMessageDialog. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Memory question
Am Donnerstag, den 29.09.2005, 12:42 +0200 schrieb Christian Neumair: > 1 foo (const void *bar); and > 2 foo (void **bar); Should have a void retval. Sorry for the confusion. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Memory question
Am Mittwoch, den 28.09.2005, 21:44 -0400 schrieb Allin Cottrell: > On Wed, 28 Sep 2005, David Rosal wrote: > > > Allin Cottrell wrote: > > > >> gchar *text = g_strdup_printf("banana %d", i); > >> gtk_entry_set_text(GTK_ENTRY(entry), text); > >> g_free(text); > > > > Is the above code really safe? > gtk_entry_set_text(GTK_ENTRY(entry), "foo"); > > If gtk tried to free "foo" you'd get an immediate crash, since this > is not storage obtained via malloc. So we can infer that gtk (which > is designed by wise and sane coders!) will not attempt to free > strings that we pass into such functions. Let's investigate a few common C pointer argument conventions: 1 foo (const void *bar); means that bar will definitly not be modified. While the foo author could theoretically force to free it would require casting the const away and whoever does it is on crack: C uses call by value. So after invoking foo, which could do free ((void *)bar), and set its local local copy of bar to NULL, the outer bar variable is undefined. Using it futher will most likely result in a crash, including calling free (bar); in the outer frame again. 2 foo (void **bar); This is some sort of call by reference. You pass the address of the bar variable, i.e. char *foobar = ...; foo ((void **) &foobar); This syntax ensures that the foo function can dereference its local copy of &foobar, and make *bar (which is foobar) point to NULL after freeing, or reallocate it - do all the pointer magic (except for pointer arithmetic, because it is a void * pointer in this case). 3 void * foo (void *bar); is just a variant of 3. It will also work on the local copy of bar, and - if it changes bar - return that changed value. So you can invoke it like char *foobar = ...; foobar = foo (foobar);. I've never seen any function acting like that, to be honest. 4 void * foo (const void *bar); Just some flavor of 3, which will always return newly allocated memory in addition to that already allocated for bar, while not modifying the latter. eel_str_strip_chr [1] uses this variant. [1] http://cvs.gnome.org/viewcvs/*checkout*/eel/eel/eel-string.c -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Memory question
Am Mittwoch, den 28.09.2005, 10:58 +0200 schrieb David Rosal: > Colossus wrote: > > Am I doing the same ( memory leaking ) with g_strdup_printf ? Yes, of course. It also allocated new memory for you, but additionally merges the ith (where ith > 1) argument of the g_strdup_printf into the string as it encounters positional parameters ("%d", "%s", etc.). You should really read a good C book, preferably the K&R, to grasp the printf syntax. > > If so what is the better way to write the following code: ? > > > > response = ShowGtkMessageDialog (GTK_WINDOW > > (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK, > > g_strdup_printf ("%s",g_strerror(errno)) ); > > return; > gchar *msg = g_strdup_printf("%s", g_strerror(errno)); > response = ShowGtkMessageDialog(GTK_WINDOW(MainWindow), > GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg); > g_free(msg); > return; Uhm doing g_strdup_printf ("%s", string); doesn't have any advantage over g_strdup (string);. It is more expensive however, because it has to parse "%s". Because g_strerror returns a const char * (meaning that you may not/can't/don't have to free it, since your app doesn't own the memory), you can simply call ShowGtkMessageDialog (GTK_WINDOW (MainWindow), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, g_strerror (errno)); without leaking anything. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Memory question
Am Dienstag, den 27.09.2005, 17:53 +0200 schrieb David Rosal: > gtk_entry_set_text(GTK_ENTRY(entry), g_strdup("banana"); > > Am I leaking memory? (...) > My question is: Is that memory chunk free'd before the program exits? If I'm taken correctly, your OS is meant to free *all* memory you allocated during the program execution on exit. Leaks just mean that the memory is lost during program execution, which can be equally bad if the application runs for a long time and you leak memory very often, since the allocated but lost memory is not available for other programs. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: show the bottom of a table in a scrollable window
Christian Neumair schrieb: Jane Bryan-Jones schrieb: if the user adds a line I want to automatically show the last line (the one he’s just added) http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeView.html#gtk-tree-view-set-cursor If you're not using a tree view inside the scrolled window, but just want the scrolled window to show the bottom of its contents, use http://developer.gnome.org/doc/API/2.0/gtk/GtkScrolledWindow.html#gtk-scrolled-window-get-vadjustment http://developer.gnome.org/doc/API/2.0/gtk/GtkAdjustment.html#gtk-adjustment-set-value ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: show the bottom of a table in a scrollable window
Jane Bryan-Jones schrieb: if the user adds a line I want to automatically show the last line (the one he’s just added) http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeView.html#gtk-tree-view-set-cursor ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: [Gtk#] TreeView.
Am Dienstag, den 20.09.2005, 20:05 +0200 schrieb Nicolas Cormier: > I have a Treeview and I want to active the EnterNotifyEvent when a the > user's cursor is on a row. > > I active the EnterNotifyEvent for the treeview but it works only for > the entire of the widget. See [1] for a patch against Nautilus which does what you want. The interesting thing you have to grasp is a) you only have motion notify events inside a tree view widget b) you'll have to check what path is active on each motion event c) the algorithm you can use to detect changes to the hover path, inside the motion notification handler, where the GdkEventMotion is event, is: GtkTreePath *hover_path; GtkTreePath *last_hover_path; /* last_hover_path = foo->stored_path; fetch last hover path */ gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), event->x, event->y, &hover_path, NULL, NULL, NULL); /* foo->stored_path = hover_path; write back new hover path */ if (!(last_hover_path == NULL && hover_path == NULL) && (!(last_hover_path != NULL && hover_path != NULL) || gtk_tree_path_compare (last_hover_path, hover_path) != NULL)) { /* do whatever you want with the new hover path */ } [1] http://bugzilla.gnome.org/attachment.cgi?id=49082&action=view -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_window_set_default does not work (for me)
Am Montag, den 19.09.2005, 10:33 +0530 schrieb Deekshit Mantampady: > Does it mean, I cannot do this on a window. I mean do I need to > use GtkDialog instead of window.. Having windows with OK buttons that are not dialogs sounds heavily broken. However, you can either connect to the "activate" handler of the GtkEntry, or use gtk_window_set_default (win, ok_widget) instead of gtk_dialog_set_default_response. > On 9/13/05, Christian Neumair <[EMAIL PROTECTED]> wrote: > > Am Montag, den 12.09.2005, 18:11 +0530 schrieb Deekshit Mantampady: > > > Hi all, > > > I have a window where I want to make the OK button to repond to > > > enter keys. I used > > > gtk_window_set_default(window, okbtn); I also set GTK_CAN_DEFAULT flag > > > before using that. But pressing the entre key does not work. > > > > You should use gtk_dialog_set_default_response and, if the dialog > > contains an entry, gtk_entry_set_activates_default. > > > > -- > > Christian Neumair <[EMAIL PROTECTED]> > > > > > > -BEGIN PGP SIGNATURE- > > Version: GnuPG v1.4.1 (GNU/Linux) > > > > iD4DBQBDJc96WfvsaU5lO4kRAkF8AJjhVVWteHWwS0KY+ueq6B4y3Ns+AJ0fI6h6 > > NU+VVJkVKWHAvN7QooJ7Fg== > > =Zf4Q > > -END PGP SIGNATURE- > > > > > > -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: notebook issue ?
Am Sonntag, den 18.09.2005, 15:55 +0200 schrieb Rss Reader: > i did what he said, but got nothing on the tab ... > > here's a snippet of what i do ... > p_tab_label = gtk_label_new ("TabName"); > p_close_button = gtk_button_new_with_label("."); > > hbox_tab = gtk_hbox_new(FALSE, 0); > gtk_box_pack_start (GTK_BOX (hbox_tab), p_close_button > , TRUE, TRUE, 0); > gtk_box_pack_start (GTK_BOX (hbox_tab), p_tab_label , > TRUE, TRUE, 0); gtk_widget_show_all (hbox_tab); > gtk_notebook_append_page ( > GTK_NOTEBOOK(p_notebook), > window, > hbox_tab); -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: notebook issue ?
Am Sonntag, den 18.09.2005, 15:45 +0200 schrieb Rss Reader: > I would like to insert a close button, on the notebook > tab, like gedit did, and i'm looking for an easy > solution, or would one explain me how to do it ? What was wrong with the answer you got under [1]? [1] http://mail.gnome.org/archives/gtk-devel-list/2005-September/msg00102.html -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Focus on vbox contained widget
Am Sonntag, den 18.09.2005, 03:07 +0300 schrieb Razvan Gavril: > Hi, > I have a GtkVBox that contains all kind of widgets. Is there a way to be > notified when one of the contained widgets grabs the focus or when the user > clicks on any of the those widget ? You can either register an event handler for the whole widget's window if it is mapped like: g_signal_connect_after (my_child, "map-event", G_CALLBACK (mapped_child), NULL); which looks like: static gboolean mapped_child (GtkWidget *child, GdkEvent *event) { gdk_window_add_filter (child->window, my_filter_func, child); } which in turn contains: static GdkFilterReturn my_filter_func (GdkXEvent *event, GdkEvent *event, GdkWidget *child) { GdkFilterReturn ret = GDK_FILTER_REMOVE; switch (event->type) { case GDK_BUTTON_PRESS_MASK: /* foo */; case GDK_ENTER_NOTIFY_MASK: /* bar */; default: ret = GDK_FILTER_CONTINUE; } return ret; } This is extremely flexible, but you usually don't have to dig that deep into GDK, at least not if you want notification for some very basic events. I'd rather suggest you to do sth. straightforward: g_signal_connect (vbox, "add", G_CALLBACK (child_added), NULL); g_signal_connect (vbox, "remove", G_CALLBACK (child_removed), NULL); static void child_added (GtkContainer *vbox, GtkWidget *child) { g_signal_connect (child, "focus-in-event", G_CALLBACK (my_focus_in_handler), vbox); g_signal_connect (child, "button-press-event", G_CALLBACK (my_button_press_handler), vbox); } static void child_removed (GtkContainer *vbox, GtkWidget *child) { g_signal_disconnect_by_func (child, my_focus_in_handler, vbox); g_signal_disconnect_by_func (child, my_button_press_handler, vbox); } -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: building gtk+ application on windows
Am Samstag, den 17.09.2005, 21:17 -0700 schrieb Suyono: > I use cygwin to compile my project on Windows but it > still need X server to run a gtk+ application. > Yesterday, my friend sent me Gimp for windows. How can > it run on Windows without X server? Thanks for helping me. It was ported and uses native windows drawing functions. You can grab GTK+ DLLs at [1] and build regular windows executables linked against it. I don't know details about the build process, so I'm CCing Tor who did most of the win32 port so that he is notifed if you still have questions. [1] http://www.gimp.org/~tml/gimp/win32/downloads.html -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GtkCellRendererCombo
Am Samstag, den 17.09.2005, 22:45 +0200 schrieb Gyözö Both: > hello, > > i can't quite figure out how to use a cell renderer combo. what i'd > like to have is a treeview column with cells that contain some text and > an icon next to the text. > > so, what i try to do is pack a column into the treeview along with a > GtkCellRendererCombo and a cell data function. in the cell data > function i create a liststore with a G_TYPE_STRING and a > GDK_TYPE_PIXBUF, fill it with a few rows, and do a > > g_object_set(renderer, "model", GTK_TREE_MODEL(ls), NULL); > g_object_unref(ls); > > ls being my GtkListStore. > > but i don't see any sign of text or icons in my treeview :-( The text will be set if you do additionally set the "text-column" property to the text column in the model. Icons are unfortunately not supported for now, IMHO. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to check if a font has a given character?
Am Donnerstag, den 15.09.2005, 17:06 -0300 schrieb Eduardo M KALINOWSKI: > Christian Neumair wrote: > > >Am Donnerstag, den 15.09.2005, 16:26 -0300 schrieb Eduardo M KALINOWSKI: > > > > > >>I want to check if the font I'm using (in a GtkTextView, if that > >>matters) contains some characters (specifically, the "line-drawing" > >>characters). How can I do that with Pango? The function > >>pango_fc_font_has_char() apparently does exactly what I want, however I > >>couldn't discover how to get a PangoFcFont *. > >> > >> > > > >You should take a look at PangoCoverage, which can be requested using > >pango_font_get_coverage (). > > > > > > > Right. Looking at it, the function pango_coverage_get() seems promising. > However, I'm unsure about the index_ argument. Would that be index of > that I want to check, according the the Unicode tables? Sorry, but I have no clue here. I think it can simply take a char, whatever its numerical value means (see below). I'd just make a font_is_suitable helper that defines a char array and iterates through it, checking pango_font_get_coverage foreach array member. I'm really interested in the meaning of a character's integer value, maybe you could explain this to us? :) -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to check if a font has a given character?
Am Donnerstag, den 15.09.2005, 16:26 -0300 schrieb Eduardo M KALINOWSKI: > I want to check if the font I'm using (in a GtkTextView, if that > matters) contains some characters (specifically, the "line-drawing" > characters). How can I do that with Pango? The function > pango_fc_font_has_char() apparently does exactly what I want, however I > couldn't discover how to get a PangoFcFont *. You should take a look at PangoCoverage, which can be requested using pango_font_get_coverage (). -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtkscrolledwindow resize atomatic
Am Mittwoch, den 14.09.2005, 18:44 -0300 schrieb Alexandre: > I have a gtkplotcanvas (from gtkextra) inside a > viewport that is inside a scrolledwindow, but, when I > resize the gtkplotcanvas to a size bigger than the > scrolledwindow the scrollbars still the same (don't > change), and I'm not able to view all the > gtkplotcanvas.. You probably didn't use gtk_scrolled_window_add_with_viewport. It will ensure that the viewport uses the same adjustements as the surrounding scrolled window. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+, UTF-8 and translations
Am Dienstag, den 13.09.2005, 21:23 +0200 schrieb HuamiSoft Hubert > Are Gtk+ .po files in UTF-8? Yes. > If so, don't you have a problem with > msgmerge complaining about invalid multibyte sequence? > I am using gettext in my program and all is fine until when I have to > merge two .po files with msgmerge which removes all multibyte > characters from msgstr tags in my original .po file. I think msgfmt <= 0.10.35 doesn't handle multibyte characters correctly. You should upgrade to a recent gettext version. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Tool tip with out Mouse ?
Am Dienstag, den 13.09.2005, 09:57 +0530 schrieb sadhees kumar: > i'm using using only the following keys in my application > 1.Left arrow > 2.Up arrow > 3.Down arrow > 4.Tab(instead of Right arrow) > 5.Enter key(Return Key) > > Is that possible with these keys? In the _class_init of your widget, you'll have to add code like: GtkBindingSet *binding_set; binding_set = gtk_binding_set_by_class (klass); gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "show-help", 1, GTK_TYPE_WIDGET_HELP_TYPE, GTK_WIDGET_HELP_TOOLTIP); gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "show-help", 1, GTK_TYPE_WIDGET_HELP_TYPE, GTK_WIDGET_HELP_TOOLTIP); You can probably also manually enforce displaying the tooltip using: g_signal_emit_by_name (foo_widget, "show-help", GTK_WIDGET_HELP_TOOLTIP); > On 9/12/05, Christian Neumair <[EMAIL PROTECTED]> wrote: > Am Montag, den 12.09.2005, 16:39 +0530 schrieb sadhees kumar: > > hi friends, > > In my application, i am not using mouse. But i want to > display the tool > > tips. If i get the focus for any particular widget, i need > to display the > > tool tips for that widget... > > Is that possible? > > Try ctrl-F1. The private API involved is > gtktooltips.h:void > _gtk_tooltips_toggle_keyboard_mode > (GtkWidget *widget); > > -- > Christian Neumair <[EMAIL PROTECTED]> > > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.1 (GNU/Linux) > > iD8DBQBDJWjWWfvsaU5lO4kRAlEFAJ0SCIwe9H5pWfz > +/u6S/9KKeBJrNwCgnIYY > gbY2iSA8nonELi/6tVPq49U= > =ZmSo > -END PGP SIGNATURE- > > > -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_window_set_default does not work (for me)
Am Montag, den 12.09.2005, 18:11 +0530 schrieb Deekshit Mantampady: > Hi all, > I have a window where I want to make the OK button to repond to > enter keys. I used > gtk_window_set_default(window, okbtn); I also set GTK_CAN_DEFAULT flag > before using that. But pressing the entre key does not work. You should use gtk_dialog_set_default_response and, if the dialog contains an entry, gtk_entry_set_activates_default. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Tool tip with out Mouse ?
Am Montag, den 12.09.2005, 16:39 +0530 schrieb sadhees kumar: > hi friends, > In my application, i am not using mouse. But i want to display the tool > tips. If i get the focus for any particular widget, i need to display the > tool tips for that widget... > Is that possible? Try ctrl-F1. The private API involved is gtktooltips.h:void _gtk_tooltips_toggle_keyboard_mode (GtkWidget *widget); -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Semi-transparent GdkWindows?
Matthias Clasen schrieb: On Sun, 2005-09-11 at 12:49 +0200, Christian Neumair wrote: Help appreciated! You need to use an RGBA visual for your window, see gdk_screen_get_rgba_visual(). Thanks! Even then, the window will not be transparent unless a compositing manager is running, which is not really detectable currently. Thats the reason why I did not implement this in gtkdnd.c when I worked on cursors. I don't see why this prevents us from integrating this functionality into GTK+. Since a clipping bitmap is always set for drag icons, the onliest bad thing that can happen is that your drag icons aren't semi-transparent at locations where the alpha value is between 1 and 254, right? Since Metacity and many other WMs support this as of writing, you can always tell people to grab a recent WM. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Semi-transparent GdkWindows?
Am Sonntag, den 11.09.2005, 10:41 +0200 schrieb Christian Neumair: > Am Sonntag, den 11.09.2005, 10:26 +0200 schrieb Christian Neumair: > > I'm currently trying to implement a semi-transparent drag window for > > Nautilus. I'm trying to do this by creating a window widget and > > connecting to its "expose-event", and then drawing onto it this handler. > > Unfortunately, gdk_window_shape_combine_mask takes a bilevel alpha mask, > > i.e. full alpha vs. no alpha, probably since the X extension it uses > > just sets the window shape, so all I can do is draw a offscreen drawable > > on the windows and set its bilevel alpha mask. > > > > I played around with cairo, but it also seems to draw onto the window > > and there doesn't seem to be any way to do something like > > gdk_window_fill (0x). > > > > So my sad and hopefully wrong conclusion is that GdkWindows and the > > underlying Windows don't seem to have a full alpha channel. Can cairo > > help me here? Do we need a new, more powerful, X extension? > > > > Thanks for your replies in advance! > > Sorry for molesting you. I was just tired and a bit frustrated because I > spent a whole night on the issue. Turns out that probably GTK+/GDK API > isn't powerful enough and I have to use Xrender. I wanted to do this using cairo, but I failed. I have a GdkPixbuf containing alpha information. My cairo context is created for my GdkWindow on "expose-event". When painting with cairo_paint_with_alpha, I still don't get transparency effects for the containing Window. I suppose that I'm just painting on top of the Window instead of painting the Window itself. Do I need a compositing manager and the compositing extension [1] that this works? There seem to be internal cairo functions which could be useful, like _cairo_surface_composite. Help appreciated! [1] http://freedesktop.org/wiki/Software_2fCompositeExt -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Semi-transparent GdkWindows?
Am Sonntag, den 11.09.2005, 10:26 +0200 schrieb Christian Neumair: > I'm currently trying to implement a semi-transparent drag window for > Nautilus. I'm trying to do this by creating a window widget and > connecting to its "expose-event", and then drawing onto it this handler. > Unfortunately, gdk_window_shape_combine_mask takes a bilevel alpha mask, > i.e. full alpha vs. no alpha, probably since the X extension it uses > just sets the window shape, so all I can do is draw a offscreen drawable > on the windows and set its bilevel alpha mask. > > I played around with cairo, but it also seems to draw onto the window > and there doesn't seem to be any way to do something like > gdk_window_fill (0x). > > So my sad and hopefully wrong conclusion is that GdkWindows and the > underlying Windows don't seem to have a full alpha channel. Can cairo > help me here? Do we need a new, more powerful, X extension? > > Thanks for your replies in advance! Sorry for molesting you. I was just tired and a bit frustrated because I spent a whole night on the issue. Turns out that probably GTK+/GDK API isn't powerful enough and I have to use Xrender. -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Semi-transparent GdkWindows?
I'm currently trying to implement a semi-transparent drag window for Nautilus. I'm trying to do this by creating a window widget and connecting to its "expose-event", and then drawing onto it this handler. Unfortunately, gdk_window_shape_combine_mask takes a bilevel alpha mask, i.e. full alpha vs. no alpha, probably since the X extension it uses just sets the window shape, so all I can do is draw a offscreen drawable on the windows and set its bilevel alpha mask. I played around with cairo, but it also seems to draw onto the window and there doesn't seem to be any way to do something like gdk_window_fill (0x). So my sad and hopefully wrong conclusion is that GdkWindows and the underlying Windows don't seem to have a full alpha channel. Can cairo help me here? Do we need a new, more powerful, X extension? Thanks for your replies in advance! -- Christian Neumair <[EMAIL PROTECTED]> ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list