mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-05-01 11:41:30 +00:00
Enhancement: Fixes #498, wizard97 - initial implementation
This commit is contained in:
@@ -70,6 +70,8 @@ add_library(
|
||||
public/msgbox.h
|
||||
src/profile.c
|
||||
public/profile.h
|
||||
src/radio.c
|
||||
public/radio.h
|
||||
src/regex.c
|
||||
public/regex.h
|
||||
public/shorthand.h
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
* Destroys all child widgets of a container.
|
||||
*
|
||||
* @param container The container.
|
||||
* @param destroy True to destroy, rather than just remove, the children.
|
||||
*/
|
||||
void wintc_container_clear(
|
||||
GtkContainer* container
|
||||
GtkContainer* container,
|
||||
gboolean destroy
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "@LIB_HEADER_DIR@/menu.h"
|
||||
#include "@LIB_HEADER_DIR@/msgbox.h"
|
||||
#include "@LIB_HEADER_DIR@/profile.h"
|
||||
#include "@LIB_HEADER_DIR@/radio.h"
|
||||
#include "@LIB_HEADER_DIR@/regex.h"
|
||||
#include "@LIB_HEADER_DIR@/shorthand.h"
|
||||
#include "@LIB_HEADER_DIR@/signals.h"
|
||||
|
||||
19
shared/comgtk/public/radio.h
Normal file
19
shared/comgtk/public/radio.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef __COMGTK_RADIO_H__
|
||||
#define __COMGTK_RADIO_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
|
||||
/**
|
||||
* Retrieve the index of the active selection in a radio button group.
|
||||
*
|
||||
* @param group The radio button group.
|
||||
*/
|
||||
guint wintc_radio_group_get_selection(
|
||||
GSList* group
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -7,17 +7,29 @@
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
void wintc_container_clear(
|
||||
GtkContainer* container
|
||||
GtkContainer* container,
|
||||
gboolean destroy
|
||||
)
|
||||
{
|
||||
GList* children = gtk_container_get_children(container);
|
||||
GList* iter = children;
|
||||
|
||||
while (iter)
|
||||
if (destroy)
|
||||
{
|
||||
gtk_widget_destroy(GTK_WIDGET(iter->data));
|
||||
|
||||
iter = iter->next;
|
||||
for (; iter; iter = iter->next)
|
||||
{
|
||||
gtk_widget_destroy(GTK_WIDGET(iter->data));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (; iter; iter = iter->next)
|
||||
{
|
||||
gtk_container_remove(
|
||||
container,
|
||||
GTK_WIDGET(iter->data)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free(children);
|
||||
|
||||
31
shared/comgtk/src/radio.c
Normal file
31
shared/comgtk/src/radio.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../public/radio.h"
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
guint wintc_radio_group_get_selection(
|
||||
GSList* group
|
||||
)
|
||||
{
|
||||
GSList* iter = group;
|
||||
|
||||
for (guint i = 0; iter; iter = iter->next, i++)
|
||||
{
|
||||
if (
|
||||
gtk_toggle_button_get_active(
|
||||
GTK_TOGGLE_BUTTON(iter->data)
|
||||
)
|
||||
)
|
||||
{
|
||||
// From GtkBuilder, it's in reverse
|
||||
//
|
||||
return g_slist_length(group) - i - 1;
|
||||
}
|
||||
}
|
||||
|
||||
g_critical("%s", "comgtk: no radio in group was active");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user