Re: Combobox disable item

2017-06-23 Thread Eric Cashon via gtk-app-devel-list

 
Add an extra column to your list and use that to set your "sensitive" property 
for the row. 

Eric


/*
gcc -Wall combo_filter2.c -o combo_filter2 `pkg-config --cflags --libs 
gtk+-3.0`
Tested on GTK3.18 and Ubuntu16.04
*/
#include

static void combo2_changed(GtkComboBox *combo2, gpointer data)
  {
gint combo_row=gtk_combo_box_get_active(combo2);
if(combo_row==1)
  {
GtkTreeIter iter;
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(data), &iter, "1");
gtk_list_store_set(GTK_LIST_STORE(data), &iter, 1, FALSE, -1);
  }
else
  {
GtkTreeIter iter;
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(data), &iter, "1");
gtk_list_store_set(GTK_LIST_STORE(data), &iter, 1, TRUE, -1);
  }
  }
int main(int argc, char *argv[])
  {
gtk_init(&argc, &argv);

GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Combo Filter2");
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 300, 100);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

GtkTreeIter iter;
GtkListStore *store=gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_BOOLEAN);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, "Scandvb", 1, TRUE, -1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, "DVB module", 1, TRUE, -1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, "DVDb5-Scan", 1, TRUE, -1);
gtk_list_store_append(store, &iter);

GtkCellRenderer *renderer=gtk_cell_renderer_text_new();

GtkWidget *combo1=gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo1), renderer, TRUE);
gtk_widget_set_hexpand(combo1, TRUE);
gtk_widget_set_vexpand(combo1, TRUE);
gtk_combo_box_set_active(GTK_COMBO_BOX(combo1), 0);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo1), 
GTK_CELL_RENDERER(renderer), "text", 0, "sensitive", 1, NULL);

GtkWidget *combo2=gtk_combo_box_text_new();
gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo2), 0, "1", "Show All");
gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo2), 1, "2", "Disable DVB 
module");
gtk_combo_box_set_active(GTK_COMBO_BOX(combo2), 0);
gtk_widget_set_hexpand(combo2, TRUE);
gtk_widget_set_vexpand(combo2, TRUE);
g_signal_connect(combo2, "changed", G_CALLBACK(combo2_changed), store);

g_object_unref(G_OBJECT(store));

GtkWidget *grid=gtk_grid_new();
gtk_grid_attach(GTK_GRID(grid), combo1, 0, 0, 1, 1);
gtk_grid_attach(GTK_GRID(grid), combo2, 0, 1, 1, 1);
gtk_container_add(GTK_CONTAINER(window), grid);
   
gtk_widget_show_all(window);
gtk_main();
return 0;   
  }



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


Re: Header bar: Keyboard accessibility?

2017-06-23 Thread Michael Torrie
On 06/23/2017 12:35 PM, Yuri Khan wrote:
> On Sat, Jun 24, 2017 at 1:21 AM, Michael Torrie  wrote:
> 
>>> I’m on 3.18, and here’s my test application/mockup:
>>>
>>> http://yurikhan.github.io/images/20170623-gtk-header-bar.png
>>
>> Oh I see. Yes that's different.  The application menu usually refers (at
>> least in my mind) to the now ubiquitous hamburger menu that all Gnome
>> apps seem to sport.
> 
> In *your* *mind*? Application menu is an official term. The menu that
> is assigned via gtk_application_set_app_menu.

You're right, and this does seem like a pretty serious oversight.  I see
that gedit did not have (at least on my version of gnome) an application
menu at all.  gnome-calculator does, though, and it's definitely not
keyboard accessible, which is a very strange design choice, if it's not
a bug.

> What you are describing is called the “gear menu”. The only
> application I have seen so far where it was activated with F10 is
> Gitg. And Gedit tries to do that too, unsuccessfully.

I've looked at a few Gnome 3 apps just now and F10 was able to open the
gear menu for all of those, including Gedit.  I'm not using Gnome 3 as a
desktop environment.


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

Re: Header bar: Keyboard accessibility?

2017-06-23 Thread Yuri Khan
On Sat, Jun 24, 2017 at 1:21 AM, Michael Torrie  wrote:

>> I’m on 3.18, and here’s my test application/mockup:
>>
>> http://yurikhan.github.io/images/20170623-gtk-header-bar.png
>
> Oh I see. Yes that's different.  The application menu usually refers (at
> least in my mind) to the now ubiquitous hamburger menu that all Gnome
> apps seem to sport.

In *your* *mind*? Application menu is an official term. The menu that
is assigned via gtk_application_set_app_menu.

What you are describing is called the “gear menu”. The only
application I have seen so far where it was activated with F10 is
Gitg. And Gedit tries to do that too, unsuccessfully.

> I guess what you're trying to trigger is what we
> used to call the window menu?  In the old days before client-side
> decorations, alt-space would trigger that menu.

And no, that is not the window menu. The window menu of the old days
would contain the window-manager-defined commands such as Move,
Resize, Minimize, Maximize and Close. The application menu is fully
application-defined. And applications put important functionality
there, such as displaying the preferences box.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Header bar: Keyboard accessibility?

2017-06-23 Thread Michael Torrie
On 06/23/2017 11:15 AM, Yuri Khan wrote:
> What GTK3 version are you on? Could you make a screenshot so I could
> see we’re talking about the same thing?

Gtk 3.20 here.

> 
> I’m on 3.18, and here’s my test application/mockup:
> 
> http://yurikhan.github.io/images/20170623-gtk-header-bar.png

Oh I see. Yes that's different.  The application menu usually refers (at
least in my mind) to the now ubiquitous hamburger menu that all Gnome
apps seem to sport. I guess what you're trying to trigger is what we
used to call the window menu?  In the old days before client-side
decorations, alt-space would trigger that menu.




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

Re: gtk_rgba_parse retunr wrong color

2017-06-23 Thread Eric Williams

Hello,

On 06/23/2017 10:54 AM, Rúben Rodrigues wrote:

Hi,

Someone knows why gdk_rgba_parse returns worng color?

I have this gdk_rgba_parse(&front_color,"rgb(8,178,23)");
cairo_set_source_rgba(cr, front_color.red, front_color.blue,
front_color.green, front_color.alpha);

The color should be green but returns blue...

Thanks


The order of the parameters to cairo_set_source_rgba() are wrong. It 
should be: cr, red, green, blue, alpha.


See: 
https://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-source-rgba



--
Eric Williams
Associate Software Engineer - Eclipse Team
Red Hat
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

gtk_rgba_parse retunr wrong color

2017-06-23 Thread Rúben Rodrigues
Hi,

Someone knows why gdk_rgba_parse returns worng color?

I have this gdk_rgba_parse(&front_color,"rgb(8,178,23)");
   cairo_set_source_rgba(cr, front_color.red, front_color.blue, 
front_color.green, front_color.alpha);

The color should be green but returns blue...

Thanks


---
Este e-mail foi verificado em termos de vírus pelo software antivírus Avast.
https://www.avast.com/antivirus

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

Re: Header bar: Keyboard accessibility?

2017-06-23 Thread Yuri Khan
On Fri, Jun 23, 2017 at 11:15 AM, Michael Torrie  wrote:

> All the Gnome 3 apps that use a header bar that I have at my disposal
> let me open the application menu with F10.  Even when I run the app
> under the most primitive window manager out there, TWM.  Are they doing
> something different than your app?

What GTK3 version are you on? Could you make a screenshot so I could
see we’re talking about the same thing?

I’m on 3.18, and here’s my test application/mockup:

http://yurikhan.github.io/images/20170623-gtk-header-bar.png

In my testing, F10 focuses the first focusable control in the header
bar, if any.

This happens in gtk/gtkwindow.c, function gtk_window_activate_menubar.
First, it checks if the window has a title bar and whether focus is
inside it; if not, it focuses the title bar, which presumably causes
its first focusable descendant to be focused. If it is, it focuses the
next menu bar if any.

The button that houses the application menu fallback is created as
unfocusable, and it has been that way since 2013.

https://git.gnome.org/browse/gtk+/commit/?id=d9f9242
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Creating custom widget linker error

2017-06-23 Thread Rúben Rodrigues
Hi,

I'm trying to create a custom widget like in this example: 
http://djcj.org/gtk/

The example works, but when i try to make something similar i get a 
linker error, and don't understand why!

Error:

make all
Building target: ConsolaGrafica
Invoking: Cross GCC Linker
arm-linux-gnueabihf-gcc -L/opt/x-tools/rootfs/rpi/usr/local/lib 
-L/lib/arm-linux-gnueabihf -L/opt/x-tools/rootfs/rpi/home/pi/jsmn 
-L/usr/lib/gcc-cross/arm-linux-gnueabi/5/ 
-L/opt/x-tools/rootfs/rpi/home/pi/linechart-dist/anychart 
-L/usr/lib/arm-linux-gnueabihf --sysroot=/opt/x-tools/rootfs/rpi 
`pkg-config --libs gmodule-export-2.0` 
/opt/x-tools/rootfs/rpi/usr/lib/arm-linux-gnueabihf/libstdc++.so.6 -o 
"ConsolaGrafica"  ./src/home/Home_Alarms.o ./src/home/Home_Cooling.o 
./src/home/Home_Houses.o ./src/home/Home_Sensors.o  
./src/gtk-linechart/gtk-linechart.o ./src/dialogs/Setup_Alarms.o 
./src/dialogs/Setup_Cooling_Reduction.o ./src/dialogs/Setup_Exits.o 
./src/dialogs/Setup_Heating.o ./src/dialogs/Setup_Lighting.o 
./src/dialogs/Setup_ProbeEnable.o ./src/dialogs/Setup_Progression.o 
./src/dialogs/Setup_Super_Coolers.o ./src/dialogs/Setup_Super_Cooling.o 
./src/dialogs/Setup_Super_ProbeCal.o ./src/dialogs/Setup_TimeDate.o 
./src/dialogs/Setup_Weight.o ./src/dialogs/ask_passcode.o  
./src/customwidgets/circulargauge.o 
./src/customwidgets/circularprogressbar.o ./src/customwidgets/gtkmeter.o 
./src/customwidgets/mycpu.o ./src/customwidgets/psquare.o 
./src/customwidgets/stroker-nodalcontainer.o  ./src/Database.o 
./src/EditableTable.o ./src/Keypad.o ./src/LogView.o ./src/Main.o 
./src/SaveConfig.o ./src/StatusBar.o ./src/UpdateConfig.o 
./src/UpdateStatus.o ./src/callbacks.o   -lgtk-3 -lX11 -lcurl -lgdk-3 
-lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo 
-lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgmodule-2.0 
-lpthread -lmysqlclient -lz -ldl -lm -lpangoft2-1.0 -lfontconfig 
-lfreetype -lgthread-2.0 -lanychart -lstdc++ -ljsmn
./src/customwidgets/circularprogressbar.o: In function 
`circular_progressbar_set_property':
/home/autofran_ruben/dev/consola/ConsolaGrafica/RaspberryPiDebug/../src/customwidgets/circularprogressbar.c:145:
 
undefined reference to `circular_progress_bar_get_type'


Definition (.h file):

GType  circular_progress_bar_get_type (void) G_GNUC_CONST;

#define GTK_CIRCULAR_PROGRESSBAR_TYPE (circular_progress_bar_get_type ())
#define GTK_CIRCULAR_PROGRESSBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST 
((obj), GTK_CIRCULAR_PROGRESSBAR_TYPE, CircularProgressBar))
#define GTK_CIRCULAR_PROGRESSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST 
((klass), GTK_CIRCULAR_PROGRESSBAR_TYPE, CircularProgressBarClass))
#define GTK_CIRCULAR_IS_PROGRESSBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE 
((obj), GTK_CIRCULAR_PROGRESSBAR_TYPE))
#define GTK_CIRCULAR_IS_PROGRESSBAR_CLASS(klass) 
(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_CIRCULAR_PROGRESSBAR_TYPE))
#define GTK_CIRCULAR_PROGRESSBAR_GET_CLASS(obj) 
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_CIRCULAR_PROGRESSBAR_TYPE, 
CircularProgressBarClass))

Thanks


---
Este e-mail foi verificado em termos de vírus pelo software antivírus Avast.
https://www.avast.com/antivirus

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

Re: Combobox disable item

2017-06-23 Thread Mike Martin
I am trying to make entries "greyed-out" ie: disabled, rather than hidden


eg the Combobox model contains ('Scandvb','DVB module','DVDb5-Scan')
There is another comboox with a configuration file chosen

I want to be able to make one or more of the entries unselectable if
prerequites are not available or the wrong type of config file is selected,
but still show the option as a prompt

thanks

On 22 June 2017 at 21:09,  wrote:

>
>
> Hi Mike,
>
> What part of the combo box are you trying to disable? If you want to
> filter rows or columns you can set up a tree model filter to do so. Maybe
> something like the following?
>
> Eric
>
>
> /*
> gcc -Wall combo_filter1.c -o combo_filter1 `pkg-config --cflags --libs
> gtk+-3.0`
> Tested on GTK3.18 and Ubuntu16.04
> */
> #include
> #include
>
> static gint combo_row=0;
>
> static void change_combo(GtkComboBox *combo2, gpointer *data)
>   {
> combo_row=gtk_combo_box_get_active(combo2);
> gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(data[1]));
> gtk_combo_box_set_active(GTK_COMBO_BOX(data[0]), 0);
>   }
> static gboolean show_rgb(GtkTreeModel *model, GtkTreeIter *iter, gpointer
> data)
>   {
> gchar *string=gtk_tree_model_get_string_from_iter(model, iter);
> gint row=atoi(string);
> g_free(string);
>
> if(combo_row==1&&row<3)
>   {
> g_print("Combo1 Don't Show %i\n", row);
> return FALSE;
>   }
> else
>   {
> g_print("Combo1 Show %i\n", row);
> return TRUE;
>   }
>   }
> int main(int argc, char *argv[])
>   {
> gtk_init(&argc, &argv);
>
> GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_window_set_title(GTK_WINDOW(window), "Combo Filter");
> gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
> gtk_window_set_default_size(GTK_WINDOW(window), 300, 100);
> g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
>
> GtkTreeIter iter;
> GtkListStore *store=gtk_list_store_new(1, G_TYPE_STRING);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Yellow", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Purple", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Cyan", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Red", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Green", -1);
> gtk_list_store_append(store, &iter);
> gtk_list_store_set(store, &iter, 0, "Blue", -1);
>
> GtkTreeModel *model=gtk_tree_model_filter_new(GTK_TREE_MODEL(store),
> NULL);
> gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model), (
> GtkTreeModelFilterVisibleFunc)show_rgb, NULL, NULL);
>
> GtkCellRenderer *renderer=gtk_cell_renderer_text_new();
>
> GtkWidget *combo1=gtk_combo_box_new_with_model(model);
> gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo1), renderer, TRUE);
> gtk_widget_set_hexpand(combo1, TRUE);
> gtk_widget_set_vexpand(combo1, TRUE);
> gtk_combo_box_set_active(GTK_COMBO_BOX(combo1), 0);
> gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo1),
> GTK_CELL_RENDERER(renderer), "text", 0, NULL);
>
> GtkWidget *combo2=gtk_combo_box_text_new();
> gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo2), 0, "1", "Show
> All");
> gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(combo2), 1, "2", "Show
> RGB");
> gtk_combo_box_set_active(GTK_COMBO_BOX(combo2), 0);
> gtk_widget_set_hexpand(combo2, TRUE);
> gtk_widget_set_vexpand(combo2, TRUE);
> gpointer data[]={combo1, model};
> g_signal_connect(combo2, "changed", G_CALLBACK(change_combo), data);
>
> g_object_unref(G_OBJECT(store));
>
> GtkWidget *grid=gtk_grid_new();
> gtk_grid_attach(GTK_GRID(grid), combo1, 0, 0, 1, 1);
> gtk_grid_attach(GTK_GRID(grid), combo2, 0, 1, 1, 1);
> gtk_container_add(GTK_CONTAINER(window), grid);
>
> gtk_widget_show_all(window);
> gtk_main();
> return 0;
>   }
>
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list