Re: REMINDER: List moved to Discourse; archival in 1 week
I go down with the boat. Emmanuele Bassi via gtk-app-devel-list escreveu no dia quarta, 24/04/2019 à(s) 12:36: > Hi all; > > next week, on May 1st, this list will be archived[0]. This means no new > subscriptions, and no new email. > > If you have questions about GTK, GLib, and the rest of the core GNOME > development platform, you can use the Discourse[1] instance hosted on GNOME > infrastructure; we have a Platform/Core category, and we can use > appropriate tags that you can watch[2] and filter on. > > You can use existing single-sign on systems, like Google and Github, to > authenticate yourself; if you have a GNOME LDAP account already, you're > strongly encouraged to use that method of authentication. > > You can still use email to interact with Discourse, and a guide is > available[3] to configure your account. > > If you have any questions or feedback on Discourse, please use the > appropriate category[4]. > > Ciao, > Emmanuele. > > [0]: > https://mail.gnome.org/archives/gtk-devel-list/2019-March/msg00024.html > [1]: https://discourse.gnome.org > [2]: https://discourse.gnome.org/t/tags-and-watching/94 > [3]: https://discourse.gnome.org/t/interacting-with-discourse-via-email/46 > [4]: https://discourse.gnome.org/c/site-feedback > > -- > https://www.bassi.io > [@] ebassi [@gmail.com] > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > -- Sent from my PC, laptop or phone with Ubuntu-Linux. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkTreeView. How to hide or show an individual cell in a row
Hello, I am making a GTK3 application with GtkTreeView listing. The simple listing will show country flags + names and number of radio-channels (to later choose from). I want to show a button or icon in a column (in the cell) when the row has been selected. Otherwise the cell should be empty (button/icon is hidden). So I want to show the cell content when row is selected, otherwise hide it (hide the button). How to do this? Please be generous with examples and explanation, especially if you refer to CSS and internal layouts of cell renderers. Here is an example GTK3 application with GtkTreeView (sortable and filterable view) with some data. The sample shows a “small-arrow.png” icon in the last column. This is the cell I want to hide/show depending on the row is/is not selected. Sample code: test1.c and small-arrow.png Get them from: https://drive.google.com/drive/folders/1JfCzZPPKvtT13bIwu-dgqvKD_zwDySnt?usp=sharing // Compile and link it gcc -Wall -o test1 test1.c $(pkg-config --cflags --libs gtk±3.0) // Run it ./test1 Same question on Discourse.GNOME: https://discourse.gnome.org/t/gtktreeview-how-to-hide-or-show-an-individual-cell-in-a-row/739 Cumprimentos Osmo Moma Antero Wine tasting lad in Portugal -- Sent from my PC, laptop or phone with Ubuntu-Linux. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Finding .desktop file and application info
Hello, Yes, g_desktop_app_info_search() is exactly what I need. I will test it later. Thanks a lot for your help. // Moma tito-wolit escreveu no dia segunda, 4/03/2019 à(s) 06:59: > > > On 3/3/19 9:53 PM, Osmo Antero wrote: > > Hello Tito, > > Muito obrigado. > > Thank you, the call with "kde4-" worked fine. > > > > However, the "DesktopEntry" value from Amarok/DBus does not contain the > "kde4" part. > > Please see the MRIS2-spec: > https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry > > My application cannot guess that it must include the "kde4" to get a > valid .desktop file. > > I think g_desktop_app_info_new() should also browse all sub-directories, > but is does not. > > Hi, > > GDesktopAppInfo *app_info = > g_desktop_app_info_new("org.kde.amarok.desktop"); > if (app_info == NULL ) > app_info = g_desktop_app_info_new("kde-org.kde.amarok.desktop"); > if (app_info == NULL ) > app_info = g_desktop_app_info_new("kde2-org.kde.amarok.desktop"); > if (app_info == NULL ) > app_info = g_desktop_app_info_new("kde3-org.kde.amarok.desktop"); > if (app_info == NULL ) > app_info = g_desktop_app_info_new("kde4-org.kde.amarok.desktop"); > if (app_info == NULL ) > app_info = g_desktop_app_info_new("kde5-org.kde.amarok.desktop"); > else > puts("can't find org.kde.amarok.desktop") > > BTW: debian does set only: > > XDG_DATA_DIRS=/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share > > maybe g_desktop_app_info_search ("amarok"); > and then app_info = g_desktop_app_info_new(**strv); > > g_desktop_app_info_search () > > gchar *** > g_desktop_app_info_search (const gchar *search_string); > > Searches desktop files for ones that match search_string . > > The return value is an array of strvs. Each strv contains a list of > applications that matched search_string with an equal score. > The outer list is sorted by score so that the first strv contains the > best-matching applications, and so on. > The algorithm for determining matches is undefined and may change at any > time. > > Ciao, > Tito > > > One possible solutions is this: > > The application should find the real location and path of > "org.kde.amarok.desktop". > > The "locate" command does the same thing. > > My app cannot call "locate" directly because it depends on "sudo > updatedb". > > I will write my own routine that dives to usr/share/applications/ and > its sub folders. > > This is my best shot ! > > > > Then the app can call: > > GDesktopAppInfo *g_desktop_app_info_new_from_filename(const char > *filename); > > > > My very old app is this: (the latest is v3.0.2) > > https://launchpad.net/~audio-recorder > > > > Thanks, > > Obrigado e boa noite. > > // Moma > > Portugal > > > > > > > > > > tito-wolit via gtk-app-devel-list gtk-app-devel-list@gnome.org>> escreveu no dia domingo, 3/03/2019 à(s) > 19:42: > > > > > > > > On 3/3/19 6:36 PM, Osmo Antero via gtk-app-devel-list wrote: > > > Hello, > > > I have an application that uses g_desktop_app_info_new() function > to > > > find GDesktopAppInfo. > > > > > > I just wonder why the g_desktop_app_info_new() FAILS to find the > > > GDesktopAppInfo if the .desktop file is in a sub directory > > > under usr/share/applications/. > > > > > > So this fails: > > > GDesktopAppInfo *app_info = > g_desktop_app_info_new("org.kde.amarok.desktop") > > > > hi, > > try: > > > > GDesktopAppInfo *app_info = > g_desktop_app_info_new("kde4-org.kde.amarok.desktop") > > > > ciao, > > Tito > > > > > If the "org.kde.amarok.desktop" file is located in: > > > /usr/share/applications/kde4/org.kde.amarok.desktop > > > This is the default location of Amarok player. > > > --- > > > Then I move the file "org.kde.amarok.desktop" to > /usr/share/applications/. > > > > > > $ sudo mv /usr/share/applications/kde4/org.kde.amarok.desktop > > > /usr/share/applications/org.kde.amarok.desktop > > > > > > $ sudo updatedb > > > $ locate org.kde.amarok.desktop > > > /usr/share/applications/org
Re: Finding .desktop file and application info
Btw: Totem (GNOME `s Video Player) has very similar problem. It «lies» about its .desktop file name. It says "totem" instead of "org.gnome.Totem". My app asks for it via DBus/MPRIS2 and gets wrong data. $ locate -i totem | grep ".desktop" /usr/share/applications/org.gnome.Totem.desktop It is hard to co-operate on the Desktop when apps do stick to the damn rules. Boa noite, Moma Osmo Antero escreveu no dia domingo, 3/03/2019 à(s) 21:05: > > Osmo Antero > 20:53 (há 11 minutos) > para tito-wolit > > Hello Tito, > Muito obrigado. > Thank you, the call with "kde4-" worked fine. > > However, the "DesktopEntry" value from Amarok/DBus does not contain the > "kde4" part. > Please see the MRIS2-spec: > https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry > > My application cannot guess that it must include the "kde4" to get a valid > .desktop file. > I think g_desktop_app_info_new() should also browse all sub-directories, > but is does not. > > One possible solutions is this: > The application should find the real location and path of > "org.kde.amarok.desktop". > The "locate" command does the same thing. > My app cannot call "locate" directly because it depends on "sudo > updatedb". > I will write my own routine that dives to usr/share/applications/ and its > sub folders. > This is my best shot ! > > Then the app can call: > GDesktopAppInfo *g_desktop_app_info_new_from_filename(const char > *filename); > > My very old app is this: (the latest is v3.0.2) > https://launchpad.net/~audio-recorder > > Thanks, > Obrigado e boa noite. > // Moma > Portugal > > tito-wolit via gtk-app-devel-list escreveu > no dia domingo, 3/03/2019 à(s) 19:42: > >> >> >> On 3/3/19 6:36 PM, Osmo Antero via gtk-app-devel-list wrote: >> > Hello, >> > I have an application that uses g_desktop_app_info_new() function to >> > find GDesktopAppInfo. >> > >> > I just wonder why the g_desktop_app_info_new() FAILS to find the >> > GDesktopAppInfo if the .desktop file is in a sub directory >> > under usr/share/applications/. >> > >> > So this fails: >> > GDesktopAppInfo *app_info = >> g_desktop_app_info_new("org.kde.amarok.desktop") >> >> hi, >> try: >> >> GDesktopAppInfo *app_info = >> g_desktop_app_info_new("kde4-org.kde.amarok.desktop") >> >> ciao, >> Tito >> >> > If the "org.kde.amarok.desktop" file is located in: >> > /usr/share/applications/kde4/org.kde.amarok.desktop >> > This is the default location of Amarok player. >> > --- >> > Then I move the file "org.kde.amarok.desktop" to >> /usr/share/applications/. >> > >> > $ sudo mv /usr/share/applications/kde4/org.kde.amarok.desktop >> > /usr/share/applications/org.kde.amarok.desktop >> > >> > $ sudo updatedb >> > $ locate org.kde.amarok.desktop >> > /usr/share/applications/org.kde.amarok.desktop >> > >> > Now the call succeeds. It returns GDesktopAppInfo structure. >> > GDesktopAppInfo *app_info = >> g_desktop_app_info_new("org.kde.amarok.desktop") >> > >> > Something is wrong, because the manual says that the desktop file can >> stay >> > in a sub directory: >> > >> > """" >> > g_desktop_app_info_new () >> > GDesktopAppInfo * g_desktop_app_info_new (const char *desktop_id); >> > >> > Creates a new GDesktopAppInfo based on a desktop file id. >> > >> > A desktop file id is the basename of the desktop file, including the >> > .desktop extension. GIO is looking for a desktop file with this name in >> the >> > applications subdirectories of the XDG data directories (i.e. the >> > directories specified in the XDG_DATA_HOME and XDG_DATA_DIRS environment >> > variables). GIO also supports the prefix-to-subdirectory mapping that is >> > described in the Menu Spec (i.e. a desktop id of kde-foo.desktop will >> > match/usr/share/applications/kde/foo.desktop). >> > """" >> > >> > Just for info: >> > My application gets the "org.kde.amarok.desktop" name from Amarok via >> the >> > MPRIS2 DBus-interface. Please see "DesktopEntry" of >> > >> https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry >> > >> > Please educate me. >> > >> > Kindly >> >Osmo Moma Antero >> >Portugal >> > >> ___ >> gtk-app-devel-list mailing list >> gtk-app-devel-list@gnome.org >> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list >> > > > -- > Sent from my PC, laptop or phone with Ubuntu-Linux. > -- Sent from my PC, laptop or phone with Ubuntu-Linux. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Finding .desktop file and application info
Osmo Antero 20:53 (há 11 minutos) para tito-wolit Hello Tito, Muito obrigado. Thank you, the call with "kde4-" worked fine. However, the "DesktopEntry" value from Amarok/DBus does not contain the "kde4" part. Please see the MRIS2-spec: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry My application cannot guess that it must include the "kde4" to get a valid .desktop file. I think g_desktop_app_info_new() should also browse all sub-directories, but is does not. One possible solutions is this: The application should find the real location and path of "org.kde.amarok.desktop". The "locate" command does the same thing. My app cannot call "locate" directly because it depends on "sudo updatedb". I will write my own routine that dives to usr/share/applications/ and its sub folders. This is my best shot ! Then the app can call: GDesktopAppInfo *g_desktop_app_info_new_from_filename(const char *filename); My very old app is this: (the latest is v3.0.2) https://launchpad.net/~audio-recorder Thanks, Obrigado e boa noite. // Moma Portugal tito-wolit via gtk-app-devel-list escreveu no dia domingo, 3/03/2019 à(s) 19:42: > > > On 3/3/19 6:36 PM, Osmo Antero via gtk-app-devel-list wrote: > > Hello, > > I have an application that uses g_desktop_app_info_new() function to > > find GDesktopAppInfo. > > > > I just wonder why the g_desktop_app_info_new() FAILS to find the > > GDesktopAppInfo if the .desktop file is in a sub directory > > under usr/share/applications/. > > > > So this fails: > > GDesktopAppInfo *app_info = > g_desktop_app_info_new("org.kde.amarok.desktop") > > hi, > try: > > GDesktopAppInfo *app_info = > g_desktop_app_info_new("kde4-org.kde.amarok.desktop") > > ciao, > Tito > > > If the "org.kde.amarok.desktop" file is located in: > > /usr/share/applications/kde4/org.kde.amarok.desktop > > This is the default location of Amarok player. > > --- > > Then I move the file "org.kde.amarok.desktop" to > /usr/share/applications/. > > > > $ sudo mv /usr/share/applications/kde4/org.kde.amarok.desktop > > /usr/share/applications/org.kde.amarok.desktop > > > > $ sudo updatedb > > $ locate org.kde.amarok.desktop > > /usr/share/applications/org.kde.amarok.desktop > > > > Now the call succeeds. It returns GDesktopAppInfo structure. > > GDesktopAppInfo *app_info = > g_desktop_app_info_new("org.kde.amarok.desktop") > > > > Something is wrong, because the manual says that the desktop file can > stay > > in a sub directory: > > > > """" > > g_desktop_app_info_new () > > GDesktopAppInfo * g_desktop_app_info_new (const char *desktop_id); > > > > Creates a new GDesktopAppInfo based on a desktop file id. > > > > A desktop file id is the basename of the desktop file, including the > > .desktop extension. GIO is looking for a desktop file with this name in > the > > applications subdirectories of the XDG data directories (i.e. the > > directories specified in the XDG_DATA_HOME and XDG_DATA_DIRS environment > > variables). GIO also supports the prefix-to-subdirectory mapping that is > > described in the Menu Spec (i.e. a desktop id of kde-foo.desktop will > > match/usr/share/applications/kde/foo.desktop). > > """" > > > > Just for info: > > My application gets the "org.kde.amarok.desktop" name from Amarok via the > > MPRIS2 DBus-interface. Please see "DesktopEntry" of > > > https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry > > > > Please educate me. > > > > Kindly > >Osmo Moma Antero > >Portugal > > > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > -- Sent from my PC, laptop or phone with Ubuntu-Linux. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Finding .desktop file and application info
Hello, I have an application that uses g_desktop_app_info_new() function to find GDesktopAppInfo. I just wonder why the g_desktop_app_info_new() FAILS to find the GDesktopAppInfo if the .desktop file is in a sub directory under usr/share/applications/. So this fails: GDesktopAppInfo *app_info = g_desktop_app_info_new("org.kde.amarok.desktop") If the "org.kde.amarok.desktop" file is located in: /usr/share/applications/kde4/org.kde.amarok.desktop This is the default location of Amarok player. --- Then I move the file "org.kde.amarok.desktop" to /usr/share/applications/. $ sudo mv /usr/share/applications/kde4/org.kde.amarok.desktop /usr/share/applications/org.kde.amarok.desktop $ sudo updatedb $ locate org.kde.amarok.desktop /usr/share/applications/org.kde.amarok.desktop Now the call succeeds. It returns GDesktopAppInfo structure. GDesktopAppInfo *app_info = g_desktop_app_info_new("org.kde.amarok.desktop") Something is wrong, because the manual says that the desktop file can stay in a sub directory: g_desktop_app_info_new () GDesktopAppInfo * g_desktop_app_info_new (const char *desktop_id); Creates a new GDesktopAppInfo based on a desktop file id. A desktop file id is the basename of the desktop file, including the .desktop extension. GIO is looking for a desktop file with this name in the applications subdirectories of the XDG data directories (i.e. the directories specified in the XDG_DATA_HOME and XDG_DATA_DIRS environment variables). GIO also supports the prefix-to-subdirectory mapping that is described in the Menu Spec (i.e. a desktop id of kde-foo.desktop will match/usr/share/applications/kde/foo.desktop). Just for info: My application gets the "org.kde.amarok.desktop" name from Amarok via the MPRIS2 DBus-interface. Please see "DesktopEntry" of https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry Please educate me. Kindly Osmo Moma Antero Portugal -- Sent from my PC, laptop or phone with Ubuntu-Linux. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Searching for text in PDF files is wrong
Re-hi, I think the mark_text(...) function can be simplified. Check also open_page(...). Ref: https://pastebin.com/52dU2kv8 Feliz Natal Moma Osmo Antero escreveu no dia quarta, 19/12/2018 à(s) 20:08: > Hello, > > This code might work even you resize the window. > Please see: https://pastebin.com/GJMPwLU3 > > It draws the selected text in the "draw" event. > > ps. I hard coded the PDF_DOC and FIND_TEXT values. > > Feliz Natal, > moma, Portugal > > Marius Gedminas escreveu no dia segunda, 3/12/2018 > à(s) 17:12: > >> On Fri, Nov 30, 2018 at 09:56:12PM +0100, Радомир Хаџић via >> gtk-app-devel-list wrote: >> > I use poppler_page_find_text() to find text in PDF files. This returns >> > GList of pointers to PopplerRectangles. Then I use >> > poppler_page_render_selection() to mark the found text. >> > >> > What is wrong is that PopplerRectangles returned by >> > poppler_page_find_text() are incompatible with those that >> > poppler_page_render_selection() requests, which is why the wrong text >> > is selected. >> > >> > I have found that to make those two compatible, I have to do the >> > following to PopplerRectangles returned by poppler_page_find_text(): >> > 1) SWAP(rectangle.x1, rectangle.x2); >> > 2) SWAP(rectangle.y1, rectangle.y2); >> > 3) rectangle.y1 = page_height - rectangle.y1; >> > 4) rectangle.y2 = page_height - rectangle.y2; >> > But this does not solve the problem because the marked text cycles >> > between right and wrong again while resizing the window. >> >> > is: https://pastebin.com/h3F56Yv7 >> >> You're doing in-place coordinate conversions in your drawing code. >> Every expose event will change the coordinates event, which is why >> you're seeing the flip-flopping. >> >> Do the conversion only once, or use a local temporary PopplerRectangle >> variable and avoid in-place conversions. >> >> (I'm not familiar with poppler's APIs and cannot say if your conversion >> code is correct.) >> >> HTH, >> Marius Gedminas >> -- >> Lutetium is the heaviest and hardest of the rare earth metals, and is >> used in >> the production of umlauts and other fraktur font features. >> -- Charles Stross >> ___ >> gtk-app-devel-list mailing list >> gtk-app-devel-list@gnome.org >> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > > > > -- > Sent from my PC, laptop or phone with Ubuntu-Linux. > -- Sent from my PC, laptop or phone with Ubuntu-Linux. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Searching for text in PDF files is wrong
Hello, This code might work even you resize the window. Please see: https://pastebin.com/GJMPwLU3 It draws the selected text in the "draw" event. ps. I hard coded the PDF_DOC and FIND_TEXT values. Feliz Natal, moma, Portugal Marius Gedminas escreveu no dia segunda, 3/12/2018 à(s) 17:12: > On Fri, Nov 30, 2018 at 09:56:12PM +0100, Радомир Хаџић via > gtk-app-devel-list wrote: > > I use poppler_page_find_text() to find text in PDF files. This returns > > GList of pointers to PopplerRectangles. Then I use > > poppler_page_render_selection() to mark the found text. > > > > What is wrong is that PopplerRectangles returned by > > poppler_page_find_text() are incompatible with those that > > poppler_page_render_selection() requests, which is why the wrong text > > is selected. > > > > I have found that to make those two compatible, I have to do the > > following to PopplerRectangles returned by poppler_page_find_text(): > > 1) SWAP(rectangle.x1, rectangle.x2); > > 2) SWAP(rectangle.y1, rectangle.y2); > > 3) rectangle.y1 = page_height - rectangle.y1; > > 4) rectangle.y2 = page_height - rectangle.y2; > > But this does not solve the problem because the marked text cycles > > between right and wrong again while resizing the window. > > > is: https://pastebin.com/h3F56Yv7 > > You're doing in-place coordinate conversions in your drawing code. > Every expose event will change the coordinates event, which is why > you're seeing the flip-flopping. > > Do the conversion only once, or use a local temporary PopplerRectangle > variable and avoid in-place conversions. > > (I'm not familiar with poppler's APIs and cannot say if your conversion > code is correct.) > > HTH, > Marius Gedminas > -- > Lutetium is the heaviest and hardest of the rare earth metals, and is used > in > the production of umlauts and other fraktur font features. > -- Charles Stross > ___ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Sent from my PC, laptop or phone with Ubuntu-Linux. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list