Cleaning: Fixes #126, C code has no documentation

This commit is contained in:
Rory Fewell
2024-03-02 22:17:49 +00:00
parent 59dff93fc5
commit 65d041ec1c
261 changed files with 5649 additions and 2691 deletions

View File

@@ -32,15 +32,14 @@ add_library(
libwintc-comctl
src/resources.c
src/animctl.c
src/animctl.h
public/animctl.h
src/style.c
src/style.h
public/style.h
)
set_target_properties(
libwintc-comctl
PROPERTIES
PUBLIC_HEADER public/wintc-comctl.h
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
@@ -80,9 +79,9 @@ target_link_libraries(
#
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
wintc_install_public_headers()
install(
TARGETS libwintc-comctl
LIBRARY DESTINATION ${LIB_DIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${LIB_DIR}
)

View File

@@ -0,0 +1,7 @@
#ifndef __WINTC_COMCTL_H__
#define __WINTC_COMCTL_H__
#include "comctl/animctl.h"
#include "comctl/style.h"
#endif

View File

@@ -0,0 +1,162 @@
/** @file */
#ifndef __COMCTL_ANIMCTL_H__
#define __COMCTL_ANIMCTL_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
//
// PUBLIC DEFINES
//
/**
* @def WINTC_CTL_ANIMATION_INFINITE
*
* Specifies that the animation should be looped indefinitely.
*/
#define WINTC_CTL_ANIMATION_INFINITE 0
/**
* @def WINTC_CTL_ANIMATION_NONE
*
* Represents no animation.
*/
#define WINTC_CTL_ANIMATION_NONE 0
//
// GTK OOP BOILERPLATE
//
typedef struct _WinTCCtlAnimationClass WinTCCtlAnimationClass;
/**
* A WinTC animation control.
*/
typedef struct _WinTCCtlAnimation WinTCCtlAnimation;
#define WINTC_TYPE_CTL_ANIMATION (wintc_ctl_animation_get_type())
#define WINTC_CTL_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WINTC_TYPE_CTL_ANIMATION, WinTCCtlAnimation))
#define WINTC_CTL_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WINTC_TYPE_CTL_ANIMATION, WinTCCtlAnimation))
#define IS_WINTC_CTL_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WINTC_TYPE_CTL_ANIMATION))
#define IS_WINTC_CTL_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WINTC_TYPE_CTL_ANIMATION))
#define WINTC_CTL_ANIMATION_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), WINTC_TYPE_CTL_ANIMATION))
GType wintc_ctl_animation_get_type(void) G_GNUC_CONST;
//
// PUBLIC FUNCTIONS
//
/**
* Creates a new instance of WinTCCtlAnimation.
*
* @return The new WinTCCtlAnimation instance cast to GtkWidget.
*/
GtkWidget* wintc_ctl_animation_new(void);
/**
* Adds a framesheet to an animation control.
*
* @param anim The animation control.
* @param framesheet_pixbuf The framesheet.
* @param frame_count The number of frames in the framesheet.
* @return The ID to reference the framesheet in the animation control.
*/
guint wintc_ctl_animation_add_framesheet(
WinTCCtlAnimation* anim,
GdkPixbuf* framesheet_pixbuf,
gint frame_count
);
/**
* Adds a static frame to an animation control.
*
* @param anim The animation control.
* @param static_pixbuf The single frame.
* @return The ID to reference the frame in the animation control.
*/
guint wintc_ctl_animation_add_static(
WinTCCtlAnimation* anim,
GdkPixbuf* static_pixbuf
);
/**
* Retrieves the number of animations in an animation control.
*
* @param anim The animation control.
*/
guint wintc_ctl_animation_get_count(
WinTCCtlAnimation* anim
);
/**
* Retrieves the horizontal alignment property of an animation control.
*
* @param anim The animation control.
* @return The current horizontal alignment of the animation control.
*/
GtkAlign wintc_ctl_animation_get_halign(
WinTCCtlAnimation* anim
);
/**
* Retrieves the vertical alignment property of an animation control.
*
* @param anim The animation control.
* @return The current vertical alignment of the animation control.
*/
GtkAlign wintc_ctl_animation_get_valign(
WinTCCtlAnimation* anim
);
/**
* Plays an animation in an animation control.
*
* @param anim The animation control.
* @param id The ID of the animation to play.
* @param frame_rate The desired frame rate for playback.
* @param repeats The number of times to repeat the animation.
*/
void wintc_ctl_animation_play(
WinTCCtlAnimation* anim,
guint id,
gint frame_rate,
gint repeats
);
/**
* Removes an animation from an animation control.
*
* @param anim The animation control.
* @param id The ID of the animation to remove.
*/
void wintc_ctl_animation_remove(
WinTCCtlAnimation* anim,
guint id
);
/**
* Sets the horizontal alignment property of an animation control.
*
* @param anim The animation control.
* @param align The desired horizontal alignment.
*/
void wintc_ctl_animation_set_halign(
WinTCCtlAnimation* anim,
GtkAlign align
);
/**
* Sets the vertical alignment property of an animation control.
*
* @param anim The animation control.
* @param align The desired vertical alignment.
*/
void wintc_ctl_animation_set_valign(
WinTCCtlAnimation* anim,
GtkAlign align
);
#endif

View File

@@ -0,0 +1,24 @@
/** @file */
#ifndef __COMCTL_STYLE_H__
#define __COMCTL_STYLE_H__
/**
* @def WINTC_CTL_BUTTON_BOX_CSS_CLASS
*
* The CSS class for applying WinTC standard button box styles, intended for
* GtkBox widgets.
*/
#define WINTC_CTL_BUTTON_BOX_CSS_CLASS "wintc-button-box"
//
// PUBLIC FUNCTIONS
//
/**
* Installs the common controls stylesheet to the default display, the styles
* have fallback priority and can be overridden by themes and programs.
*/
void wintc_ctl_install_default_styles(void);
#endif

View File

@@ -1,73 +0,0 @@
#ifndef __WINTC_COMCTL_H__
#define __WINTC_COMCTL_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
//
// Animation control
//
#define WINTC_ANIMATION_INFINITE 0
#define WINTC_ANIMATION_NONE 0
typedef struct _WinTCAnimationPrivate WinTCAnimationPrivate;
typedef struct _WinTCAnimationClass WinTCAnimationClass;
typedef struct _WinTCAnimation WinTCAnimation;
#define TYPE_WINTC_ANIMATION (wintc_animation_get_type())
#define WINTC_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_ANIMATION, WinTCAnimation))
#define WINTC_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_ANIMATION, WinTCAnimation))
#define IS_WINTC_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_ANIMATION))
#define IS_WINTC_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_ANIMATION))
#define WINTC_ANIMATION_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), TYPE_WINTC_ANIMATION))
GType wintc_animation_get_type(void) G_GNUC_CONST;
GtkWidget* wintc_animation_new(void);
guint wintc_animation_add_framesheet(
WinTCAnimation* anim,
GdkPixbuf* framesheet_pixbuf,
gint frame_count
);
guint wintc_animation_add_static(
WinTCAnimation* anim,
GdkPixbuf* static_pixbuf
);
guint wintc_animation_get_count(
WinTCAnimation* anim
);
GtkAlign wintc_animation_get_halign(
WinTCAnimation* anim
);
GtkAlign wintc_animation_get_valign(
WinTCAnimation* anim
);
void wintc_animation_play(
WinTCAnimation* anim,
guint id,
gint frame_rate,
gint repeats
);
void wintc_animation_remove(
WinTCAnimation* anim,
guint id
);
void wintc_animation_set_halign(
WinTCAnimation* anim,
GtkAlign align
);
void wintc_animation_set_valign(
WinTCAnimation* anim,
GtkAlign align
);
//
// Default CSS stuff
//
#define WINTC_COMCTL_BUTTON_BOX_CSS_CLASS "wintc-button-box"
void wintc_comctl_install_default_styles(void);
#endif

View File

@@ -2,9 +2,9 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "animctl.h"
#include "../public/animctl.h"
#define ONE_SECOND_IN_US 1000000
@@ -21,89 +21,88 @@ enum
//
// PRIVATE STURCTURE DEFINITIONS
//
typedef struct _WinTCAnimationData
typedef struct _WinTCCtlAnimationData
{
GdkPixbuf* pixbuf_bmp;
cairo_surface_t* surface_bmp;
gint frame_count;
gint frame_height;
} WinTCAnimationData;
} WinTCCtlAnimationData;
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
struct _WinTCAnimationPrivate
struct _WinTCCtlAnimationClass
{
GtkWidgetClass __parent__;
};
struct _WinTCCtlAnimation
{
GtkWidget __parent__;
// State
//
GSList* animations;
gboolean is_animating;
guint tick_id;
WinTCAnimationData* current_anim;
gint current_frame;
gint desired_repeats;
gint last_frame;
gint64 origin_frame_time;
gint64 per_frame_time;
gint64 playback_total_time;
WinTCCtlAnimationData* current_anim;
gint current_frame;
gint desired_repeats;
gint last_frame;
gint64 origin_frame_time;
gint64 per_frame_time;
gint64 playback_total_time;
// UI properties
//
GtkAlign halign;
GtkAlign valign;
};
struct _WinTCAnimationClass
{
GtkWidgetClass __parent__;
};
struct _WinTCAnimation
{
GtkWidget __parent__;
WinTCAnimationPrivate* priv;
};
//
// FORWARD DECLARATIONS
//
static void wintc_animation_finalize(
static void wintc_ctl_animation_finalize(
GObject* gobject
);
static void wintc_animation_get_property(
static void wintc_ctl_animation_get_property(
GObject* object,
guint prop_id,
GValue* value,
GParamSpec* pspec
);
static void wintc_animation_set_property(
static void wintc_ctl_animation_set_property(
GObject* object,
guint prop_id,
const GValue* value,
GParamSpec* pspec
);
static gboolean wintc_animation_draw(
static gboolean wintc_ctl_animation_draw(
GtkWidget* widget,
cairo_t* cr
);
static void wintc_animation_get_preferred_height(
static void wintc_ctl_animation_get_preferred_height(
GtkWidget* widget,
gint* minimum_height,
gint* natural_height
);
static void wintc_animation_get_preferred_height_for_width(
static void wintc_ctl_animation_get_preferred_height_for_width(
GtkWidget* widget,
gint width,
gint* minimum_height,
gint* natural_height
);
static void wintc_animation_get_preferred_width(
static void wintc_ctl_animation_get_preferred_width(
GtkWidget* widget,
gint* minimum_width,
gint* natural_width
);
static void wintc_animation_get_preferred_width_for_height(
static void wintc_ctl_animation_get_preferred_width_for_height(
GtkWidget* widget,
gint height,
gint* minimum_width,
@@ -111,10 +110,10 @@ static void wintc_animation_get_preferred_width_for_height(
);
static void free_anim_data(
WinTCAnimationData* anim_data
WinTCCtlAnimationData* anim_data
);
static gboolean wintc_animation_step(
static gboolean wintc_ctl_animation_step(
GtkWidget* widget,
GdkFrameClock* frame_clock,
gpointer user_data
@@ -123,34 +122,33 @@ static gboolean wintc_animation_step(
//
// GTK TYPE DEFINITIONS & CTORS
//
G_DEFINE_TYPE_WITH_CODE(
WinTCAnimation,
wintc_animation,
GTK_TYPE_WIDGET,
G_ADD_PRIVATE(WinTCAnimation)
G_DEFINE_TYPE(
WinTCCtlAnimation,
wintc_ctl_animation,
GTK_TYPE_WIDGET
)
static void wintc_animation_class_init(
WinTCAnimationClass* klass
static void wintc_ctl_animation_class_init(
WinTCCtlAnimationClass* klass
)
{
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
GObjectClass* object_class = G_OBJECT_CLASS(klass);
object_class->finalize = wintc_animation_finalize;
object_class->get_property = wintc_animation_get_property;
object_class->set_property = wintc_animation_set_property;
object_class->finalize = wintc_ctl_animation_finalize;
object_class->get_property = wintc_ctl_animation_get_property;
object_class->set_property = wintc_ctl_animation_set_property;
widget_class->draw =
wintc_animation_draw;
wintc_ctl_animation_draw;
widget_class->get_preferred_height =
wintc_animation_get_preferred_height;
wintc_ctl_animation_get_preferred_height;
widget_class->get_preferred_height_for_width =
wintc_animation_get_preferred_height_for_width;
wintc_ctl_animation_get_preferred_height_for_width;
widget_class->get_preferred_width =
wintc_animation_get_preferred_width;
wintc_ctl_animation_get_preferred_width;
widget_class->get_preferred_width_for_height =
wintc_animation_get_preferred_width_for_height;
wintc_ctl_animation_get_preferred_width_for_height;
g_object_class_install_property(
object_class,
@@ -178,57 +176,55 @@ static void wintc_animation_class_init(
);
}
static void wintc_animation_init(
WinTCAnimation* self
static void wintc_ctl_animation_init(
WinTCCtlAnimation* self
)
{
self->priv = wintc_animation_get_instance_private(self);
gtk_widget_set_has_window(GTK_WIDGET(self), FALSE);
}
//
// CLASS VIRTUAL METHODS
//
static void wintc_animation_finalize(
static void wintc_ctl_animation_finalize(
GObject* gobject
)
{
WinTCAnimation* anim = WINTC_ANIMATION(gobject);
WinTCCtlAnimation* anim = WINTC_CTL_ANIMATION(gobject);
g_slist_free_full(
anim->priv->animations,
anim->animations,
(GDestroyNotify) free_anim_data
);
if (anim->priv->tick_id > 0)
if (anim->tick_id > 0)
{
gtk_widget_remove_tick_callback(
GTK_WIDGET(anim),
anim->priv->tick_id
anim->tick_id
);
}
(G_OBJECT_CLASS(wintc_animation_parent_class))->finalize(gobject);
(G_OBJECT_CLASS(wintc_ctl_animation_parent_class))->finalize(gobject);
}
static void wintc_animation_get_property(
static void wintc_ctl_animation_get_property(
GObject* object,
guint prop_id,
GValue* value,
GParamSpec* pspec
)
{
WinTCAnimation* anim = WINTC_ANIMATION(object);
WinTCCtlAnimation* anim = WINTC_CTL_ANIMATION(object);
switch (prop_id)
{
case PROP_HALIGN:
g_value_set_enum(value, anim->priv->halign);
g_value_set_enum(value, anim->halign);
break;
case PROP_VALIGN:
g_value_set_enum(value, anim->priv->valign);
g_value_set_enum(value, anim->valign);
break;
default:
@@ -237,24 +233,24 @@ static void wintc_animation_get_property(
}
}
static void wintc_animation_set_property(
static void wintc_ctl_animation_set_property(
GObject* object,
guint prop_id,
const GValue* value,
GParamSpec* pspec
)
{
WinTCAnimation* anim = WINTC_ANIMATION(object);
WinTCCtlAnimation* anim = WINTC_CTL_ANIMATION(object);
switch (prop_id)
{
case PROP_HALIGN:
anim->priv->halign = g_value_get_enum(value);
anim->halign = g_value_get_enum(value);
gtk_widget_queue_draw(GTK_WIDGET(object));
break;
case PROP_VALIGN:
anim->priv->valign = g_value_get_enum(value);
anim->valign = g_value_get_enum(value);
gtk_widget_queue_draw(GTK_WIDGET(object));
break;
@@ -264,14 +260,14 @@ static void wintc_animation_set_property(
}
}
static gboolean wintc_animation_draw(
static gboolean wintc_ctl_animation_draw(
GtkWidget* widget,
cairo_t* cr
)
{
WinTCAnimation* anim = WINTC_ANIMATION(widget);
WinTCCtlAnimation* anim = WINTC_CTL_ANIMATION(widget);
if (anim->priv->current_anim == NULL)
if (anim->current_anim == NULL)
{
return FALSE;
}
@@ -284,19 +280,19 @@ static gboolean wintc_animation_draw(
graphic_width =
cairo_image_surface_get_width(
anim->priv->current_anim->surface_bmp
anim->current_anim->surface_bmp
);
if (anim->priv->current_anim->frame_count > 1)
if (anim->current_anim->frame_count > 1)
{
graphic_height = anim->priv->current_anim->frame_height;
y_offset = (graphic_height * anim->priv->current_frame) * -1.0f;
graphic_height = anim->current_anim->frame_height;
y_offset = (graphic_height * anim->current_frame) * -1.0f;
}
else
{
graphic_height =
cairo_image_surface_get_height(
anim->priv->current_anim->surface_bmp
anim->current_anim->surface_bmp
);
y_offset = 0.0f;
}
@@ -313,7 +309,7 @@ static gboolean wintc_animation_draw(
double target_scale_w = 1.0f;
double target_scale_h = 1.0f;
switch (anim->priv->halign)
switch (anim->halign)
{
case GTK_ALIGN_END:
target_x = (double) (my_width - graphic_width);
@@ -333,7 +329,7 @@ static gboolean wintc_animation_draw(
break;
}
switch (anim->priv->valign)
switch (anim->valign)
{
case GTK_ALIGN_END:
target_y = (double) (my_height - graphic_height);
@@ -372,7 +368,7 @@ static gboolean wintc_animation_draw(
cairo_set_source_surface(
cr,
anim->priv->current_anim->surface_bmp,
anim->current_anim->surface_bmp,
0.0f,
y_offset
);
@@ -385,32 +381,32 @@ static gboolean wintc_animation_draw(
cairo_restore(cr);
anim->priv->last_frame = anim->priv->current_frame;
anim->last_frame = anim->current_frame;
return FALSE;
}
static void wintc_animation_get_preferred_height(
static void wintc_ctl_animation_get_preferred_height(
GtkWidget* widget,
gint* minimum_height,
gint* natural_height
)
{
WinTCAnimation* anim = WINTC_ANIMATION(widget);
gint height = 0;
WinTCCtlAnimation* anim = WINTC_CTL_ANIMATION(widget);
gint height = 0;
if (anim->priv->current_anim != NULL)
if (anim->current_anim != NULL)
{
if (anim->priv->current_anim->frame_count == 1)
if (anim->current_anim->frame_count == 1)
{
height =
cairo_image_surface_get_height(
anim->priv->current_anim->surface_bmp
anim->current_anim->surface_bmp
);
}
else
{
height = anim->priv->current_anim->frame_height;
height = anim->current_anim->frame_height;
}
}
@@ -418,29 +414,29 @@ static void wintc_animation_get_preferred_height(
*natural_height = height;
}
static void wintc_animation_get_preferred_height_for_width(
static void wintc_ctl_animation_get_preferred_height_for_width(
GtkWidget* widget,
WINTC_UNUSED(gint width),
gint* minimum_height,
gint* natural_height
)
{
wintc_animation_get_preferred_height(
wintc_ctl_animation_get_preferred_height(
widget,
minimum_height,
natural_height
);
}
static void wintc_animation_get_preferred_width(
static void wintc_ctl_animation_get_preferred_width(
GtkWidget* widget,
gint* minimum_width,
gint* natural_width
)
{
WinTCAnimation* anim = WINTC_ANIMATION(widget);
WinTCCtlAnimation* anim = WINTC_CTL_ANIMATION(widget);
if (anim->priv->current_anim == NULL)
if (anim->current_anim == NULL)
{
minimum_width = 0;
natural_width = 0;
@@ -449,21 +445,21 @@ static void wintc_animation_get_preferred_width(
gint width =
cairo_image_surface_get_width(
anim->priv->current_anim->surface_bmp
anim->current_anim->surface_bmp
);
*minimum_width = width;
*natural_width = width;
}
static void wintc_animation_get_preferred_width_for_height(
static void wintc_ctl_animation_get_preferred_width_for_height(
GtkWidget* widget,
WINTC_UNUSED(gint height),
gint* minimum_width,
gint* natural_width
)
{
wintc_animation_get_preferred_width(
wintc_ctl_animation_get_preferred_width(
widget,
minimum_width,
natural_width
@@ -473,24 +469,26 @@ static void wintc_animation_get_preferred_width_for_height(
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_animation_new(void)
GtkWidget* wintc_ctl_animation_new(void)
{
return GTK_WIDGET(
g_object_new(
TYPE_WINTC_ANIMATION,
WINTC_TYPE_CTL_ANIMATION,
NULL
)
);
}
guint wintc_animation_add_framesheet(
WinTCAnimation* anim,
GdkPixbuf* framesheet_pixbuf,
gint frame_count
guint wintc_ctl_animation_add_framesheet(
WinTCCtlAnimation* anim,
GdkPixbuf* framesheet_pixbuf,
gint frame_count
)
{
WinTCAnimationData* anim_data = g_new0(WinTCAnimationData, 1);
gint height = gdk_pixbuf_get_height(framesheet_pixbuf);
WinTCCtlAnimationData* anim_data = g_new0(WinTCCtlAnimationData, 1);
gint height = gdk_pixbuf_get_height(
framesheet_pixbuf
);
g_object_ref(framesheet_pixbuf);
@@ -505,21 +503,21 @@ guint wintc_animation_add_framesheet(
anim_data->frame_count = frame_count;
anim_data->frame_height = height / frame_count;
anim->priv->animations =
anim->animations =
g_slist_append(
anim->priv->animations,
anim->animations,
anim_data
);
return wintc_animation_get_count(anim);
return wintc_ctl_animation_get_count(anim);
}
guint wintc_animation_add_static(
WinTCAnimation* anim,
GdkPixbuf* static_pixbuf
guint wintc_ctl_animation_add_static(
WinTCCtlAnimation* anim,
GdkPixbuf* static_pixbuf
)
{
WinTCAnimationData* anim_data = g_new0(WinTCAnimationData, 1);
WinTCCtlAnimationData* anim_data = g_new0(WinTCCtlAnimationData, 1);
g_object_ref(static_pixbuf);
@@ -534,24 +532,24 @@ guint wintc_animation_add_static(
anim_data->frame_count = 1;
anim_data->frame_height = 0;
anim->priv->animations =
anim->animations =
g_slist_append(
anim->priv->animations,
anim->animations,
anim_data
);
return wintc_animation_get_count(anim);
return wintc_ctl_animation_get_count(anim);
}
guint wintc_animation_get_count(
WinTCAnimation* anim
guint wintc_ctl_animation_get_count(
WinTCCtlAnimation* anim
)
{
return g_slist_length(anim->priv->animations);
return g_slist_length(anim->animations);
}
GtkAlign wintc_animation_get_halign(
WinTCAnimation* anim
GtkAlign wintc_ctl_animation_get_halign(
WinTCCtlAnimation* anim
)
{
GtkAlign value;
@@ -561,8 +559,8 @@ GtkAlign wintc_animation_get_halign(
return value;
}
GtkAlign wintc_animation_get_valign(
WinTCAnimation* anim
GtkAlign wintc_ctl_animation_get_valign(
WinTCCtlAnimation* anim
)
{
GtkAlign value;
@@ -572,24 +570,24 @@ GtkAlign wintc_animation_get_valign(
return value;
}
void wintc_animation_play(
WinTCAnimation* anim,
guint id,
gint frame_rate,
gint repeats
void wintc_ctl_animation_play(
WinTCCtlAnimation* anim,
guint id,
gint frame_rate,
gint repeats
)
{
// Reset anim state values
//
anim->priv->is_animating = FALSE;
anim->is_animating = FALSE;
anim->priv->current_anim = NULL;
anim->priv->current_frame = 0;
anim->priv->last_frame = 0;
anim->priv->desired_repeats = 0;
anim->priv->origin_frame_time = 0;
anim->priv->per_frame_time = 0;
anim->priv->playback_total_time = 0;
anim->current_anim = NULL;
anim->current_frame = 0;
anim->last_frame = 0;
anim->desired_repeats = 0;
anim->origin_frame_time = 0;
anim->per_frame_time = 0;
anim->playback_total_time = 0;
// Queue a draw regardless of what happens
//
@@ -597,13 +595,13 @@ void wintc_animation_play(
// Check we're being asked to actually play anything
//
if (id > wintc_animation_get_count(anim))
if (id > wintc_ctl_animation_get_count(anim))
{
g_warning("WinTCAnimation - attempted to play invalid ID %u", id);
g_warning("WinTCCtlAnimation - attempted to play invalid ID %u", id);
return;
}
if (id == WINTC_ANIMATION_NONE)
if (id == WINTC_CTL_ANIMATION_NONE)
{
return;
}
@@ -612,34 +610,34 @@ void wintc_animation_play(
//
gint real_id = id - 1; // The consumer is given the count rather than index
// in the 'add' APIs, so that we can have a special
// meaning for 0 (WINTC_ANIMATION_NONE)
// meaning for 0 (WINTC_CTL_ANIMATION_NONE)
GSList* anim_link = g_slist_nth(
anim->priv->animations,
anim->animations,
real_id
);
WinTCAnimationData* anim_data = anim_link->data;
WinTCCtlAnimationData* anim_data = anim_link->data;
anim->priv->current_anim = anim_data;
anim->current_anim = anim_data;
if (
anim_data->frame_count > 1 &&
frame_rate > 0
)
{
anim->priv->is_animating = TRUE;
anim->is_animating = TRUE;
anim->priv->desired_repeats = repeats;
anim->priv->origin_frame_time = g_get_monotonic_time();
anim->priv->per_frame_time = ONE_SECOND_IN_US / frame_rate;
anim->priv->playback_total_time =
anim->priv->per_frame_time * anim_data->frame_count;
anim->desired_repeats = repeats;
anim->origin_frame_time = g_get_monotonic_time();
anim->per_frame_time = ONE_SECOND_IN_US / frame_rate;
anim->playback_total_time =
anim->per_frame_time * anim_data->frame_count;
if (anim->priv->tick_id == 0)
if (anim->tick_id == 0)
{
gtk_widget_add_tick_callback(
GTK_WIDGET(anim),
(GtkTickCallback) wintc_animation_step,
(GtkTickCallback) wintc_ctl_animation_step,
NULL,
NULL
);
@@ -647,40 +645,40 @@ void wintc_animation_play(
}
}
void wintc_animation_remove(
WinTCAnimation* anim,
guint id
void wintc_ctl_animation_remove(
WinTCCtlAnimation* anim,
guint id
)
{
if (id == 0 || id > wintc_animation_get_count(anim))
if (id == 0 || id > wintc_ctl_animation_get_count(anim))
{
g_warning("WinTCAnimation - attempted to remove invalid ID %u", id);
g_warning("WinTCCtlAnimation - attempted to remove invalid ID %u", id);
return;
}
gint real_id = id - 1;
GSList* to_delete = g_slist_nth(anim->priv->animations, real_id);
GSList* to_delete = g_slist_nth(anim->animations, real_id);
free_anim_data(to_delete->data);
anim->priv->animations =
anim->animations =
g_slist_delete_link(
anim->priv->animations,
anim->animations,
to_delete
);
}
void wintc_animation_set_halign(
WinTCAnimation* anim,
GtkAlign align
void wintc_ctl_animation_set_halign(
WinTCCtlAnimation* anim,
GtkAlign align
)
{
g_object_set(anim, "gfx-halign", align, NULL);
}
void wintc_animation_set_valign(
WinTCAnimation* anim,
GtkAlign align
void wintc_ctl_animation_set_valign(
WinTCCtlAnimation* anim,
GtkAlign align
)
{
g_object_set(anim, "gfx-valign", align, NULL);
@@ -690,7 +688,7 @@ void wintc_animation_set_valign(
// PRIVATE FUNCTIONS
//
static void free_anim_data(
WinTCAnimationData* anim_data
WinTCCtlAnimationData* anim_data
)
{
cairo_surface_destroy(anim_data->surface_bmp);
@@ -701,39 +699,39 @@ static void free_anim_data(
//
// CALLBACKS
//
static gboolean wintc_animation_step(
static gboolean wintc_ctl_animation_step(
GtkWidget* widget,
GdkFrameClock* frame_clock,
WINTC_UNUSED(gpointer user_data)
)
{
WinTCAnimation* anim = WINTC_ANIMATION(widget);
WinTCCtlAnimation* anim = WINTC_CTL_ANIMATION(widget);
if (!anim->priv->is_animating)
if (!anim->is_animating)
{
return G_SOURCE_REMOVE;
}
gint64 frame_time = gdk_frame_clock_get_frame_time(frame_clock);
gint64 progress = frame_time - anim->priv->origin_frame_time;
gint64 repeat_no = progress / anim->priv->playback_total_time;
gint64 within_frame = progress % anim->priv->playback_total_time;
gint frame_no = (gint) (within_frame / anim->priv->per_frame_time);
gint64 progress = frame_time - anim->origin_frame_time;
gint64 repeat_no = progress / anim->playback_total_time;
gint64 within_frame = progress % anim->playback_total_time;
gint frame_no = (gint) (within_frame / anim->per_frame_time);
if (
anim->priv->desired_repeats != WINTC_ANIMATION_INFINITE &&
anim->priv->desired_repeats < repeat_no
anim->desired_repeats != WINTC_CTL_ANIMATION_INFINITE &&
anim->desired_repeats < repeat_no
)
{
return G_SOURCE_REMOVE;
}
if (anim->priv->last_frame != frame_no)
if (anim->last_frame != frame_no)
{
gtk_widget_queue_draw(widget);
}
anim->priv->current_frame = frame_no;
anim->current_frame = frame_no;
return G_SOURCE_CONTINUE;
}

View File

@@ -1,73 +0,0 @@
#ifndef __ANIMCTL_H__
#define __ANIMCTL_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
//
// PUBLIC DEFINES
//
#define WINTC_ANIMATION_INFINITE 0
#define WINTC_ANIMATION_NONE 0
//
// GTK OOP BOILERPLATE
//
typedef struct _WinTCAnimationPrivate WinTCAnimationPrivate;
typedef struct _WinTCAnimationClass WinTCAnimationClass;
typedef struct _WinTCAnimation WinTCAnimation;
#define TYPE_WINTC_ANIMATION (wintc_animation_get_type())
#define WINTC_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_ANIMATION, WinTCAnimation))
#define WINTC_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_ANIMATION, WinTCAnimation))
#define IS_WINTC_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_ANIMATION))
#define IS_WINTC_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_ANIMATION))
#define WINTC_ANIMATION_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), TYPE_WINTC_ANIMATION))
GType wintc_animation_get_type(void) G_GNUC_CONST;
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_animation_new(void);
guint wintc_animation_add_framesheet(
WinTCAnimation* anim,
GdkPixbuf* framesheet_pixbuf,
gint frame_count
);
guint wintc_animation_add_static(
WinTCAnimation* anim,
GdkPixbuf* static_pixbuf
);
guint wintc_animation_get_count(
WinTCAnimation* anim
);
GtkAlign wintc_animation_get_halign(
WinTCAnimation* anim
);
GtkAlign wintc_animation_get_valign(
WinTCAnimation* anim
);
void wintc_animation_play(
WinTCAnimation* anim,
guint id,
gint frame_rate,
gint repeats
);
void wintc_animation_remove(
WinTCAnimation* anim,
guint id
);
void wintc_animation_set_halign(
WinTCAnimation* anim,
GtkAlign align
);
void wintc_animation_set_valign(
WinTCAnimation* anim,
GtkAlign align
);
#endif

View File

@@ -2,12 +2,12 @@
#include <glib.h>
#include <gtk/gtk.h>
#include "style.h"
#include "../public/style.h"
//
// PUBLIC FUNCTIONS
//
void wintc_comctl_install_default_styles(void)
void wintc_ctl_install_default_styles(void)
{
static gboolean already_done = FALSE;

View File

@@ -1,8 +0,0 @@
#ifndef __STYLE_H__
#define __STYLE_H__
#define WINTC_COMCTL_BUTTON_BOX_CSS_CLASS "wintc-button-box"
void wintc_comctl_install_default_styles(void);
#endif

View File

@@ -27,46 +27,43 @@ include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
wintc_resolve_library(glib-2.0 GLIB)
wintc_resolve_library(gtk+-3.0 GTK3)
configure_file(public/wintc-comgtk.h.in ${PROJECT_ROOT}/public/wintc-comgtk.h @ONLY)
configure_file(src/assets.h.in ${PROJECT_ROOT}/src/assets.h @ONLY)
configure_file(src/version.c.in ${PROJECT_ROOT}/src/version.c @ONLY)
configure_file(public/assets.h.in ${PROJECT_ROOT}/public/assets.h @ONLY)
configure_file(src/version.c.in ${PROJECT_ROOT}/src/version.c @ONLY)
add_library(
libwintc-comgtk
src/assets.h
src/debug.h
public/assets.h
public/debug.h
src/container.c
src/container.h
public/container.h
src/defprocs.c
src/defprocs.h
public/defprocs.h
src/errors.c
src/errors.h
src/gchar.h
public/errors.h
src/list.c
src/list.h
public/list.h
src/marshal.c
src/marshal.h
public/marshal.h
src/msgbox.c
src/msgbox.h
public/msgbox.h
src/profile.c
src/profile.h
src/shorthand.h
public/profile.h
public/shorthand.h
src/signals.c
src/signals.h
public/signals.h
src/strings.c
src/strings.h
public/strings.h
src/styles.c
src/styles.h
public/styles.h
src/version.c
src/version.h
public/version.h
src/window.c
src/window.h
public/window.h
)
set_target_properties(
libwintc-comgtk
PROPERTIES
PUBLIC_HEADER public/wintc-comgtk.h
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
@@ -100,9 +97,9 @@ target_link_libraries(
#
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
wintc_install_public_headers()
install(
TARGETS libwintc-comgtk
LIBRARY DESTINATION ${LIB_DIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${LIB_DIR}
)

View File

@@ -0,0 +1,20 @@
#ifndef __WINTC_COMGTK_H__
#define __WINTC_COMGTK_H__
#include "comgtk/assets.h"
#include "comgtk/container.h"
#include "comgtk/debug.h"
#include "comgtk/defprocs.h"
#include "comgtk/errors.h"
#include "comgtk/list.h"
#include "comgtk/marshal.h"
#include "comgtk/msgbox.h"
#include "comgtk/profile.h"
#include "comgtk/shorthand.h"
#include "comgtk/signals.h"
#include "comgtk/strings.h"
#include "comgtk/styles.h"
#include "comgtk/version.h"
#include "comgtk/window.h"
#endif

View File

@@ -0,0 +1,14 @@
/** @file */
#ifndef __COMGTK_ASSETS_H__
#define __COMGTK_ASSETS_H__
/**
* @def WINTC_ASSETS_DIR
*
* The absolute path for the directory that contains the assets for WinTC
* components.
*/
#define WINTC_ASSETS_DIR "@CMAKE_INSTALL_PREFIX@/@WINTC_ASSETS_INSTALL_DIR@"
#endif

View File

@@ -0,0 +1,21 @@
/** @file */
#ifndef __COMGTK_CONTAINER_H__
#define __COMGTK_CONTAINER_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
/**
* Destroys all child widgets of a container.
*
* @param container The container.
*/
void wintc_container_clear(
GtkContainer* container
);
#endif

View File

@@ -0,0 +1,38 @@
/** @file */
#ifndef __COMGTK_DEBUG_H__
#define __COMGTK_DEBUG_H__
#include <glib.h>
#include <stdlib.h>
/**
* @def WINTC_ENVVAR_DEBUG_LOGGING
*
* The environment variable that, if set, will enable troubleshooting log
* output.
*/
#define WINTC_ENVVAR_DEBUG_LOGGING "WINDEBUG"
/**
* @def WINTC_LOG_USER_DEBUG(...)
*
* Logs a message to stdout if the WINDEBUG environment variable is set, this
* is intended for messages that will help end users troubleshoot a problem.
*/
#define WINTC_LOG_USER_DEBUG(...) if (getenv(WINTC_ENVVAR_DEBUG_LOGGING)) { g_message(__VA_ARGS__); }
/**
* @def WINTC_LOG_DEBUG(...)
*
* Logs a message to stdout if compiled as a checked build, this is intended
* for messages that will aid in developer debugging.
*/
#ifdef WINTC_CHECKED
#define WINTC_LOG_DEBUG(...) g_message(__VA_ARGS__);
#else
#define WINTC_LOG_DEBUG(...)
#endif
#endif

View File

@@ -1,5 +1,7 @@
#ifndef __DEFPROCS_H__
#define __DEFPROCS_H__
/** @file */
#ifndef __COMGTK_DEFPROCS_H__
#define __COMGTK_DEFPROCS_H__
#include <gdk/gdk.h>
#include <gtk/gtk.h>
@@ -9,12 +11,19 @@
//
// PUBLIC FUNCTIONS
//
/**
* Callback for deselecting a GtkMenuShell upon a notify-leave-event.
*/
void wintc_menu_shell_deselect_on_leave(
GtkWidget* widget,
WINTC_UNUSED(GdkEvent* event),
GtkMenuShell* menu_shell
);
/**
* Callback for selecting a GtkMenuShell upon a notify-enter-event.
*/
void wintc_menu_shell_select_on_enter(
GtkWidget* widget,
WINTC_UNUSED(GdkEvent* event),

View File

@@ -0,0 +1,50 @@
/** @file */
#ifndef __COMGTK_ERRORS_H__
#define __COMGTK_ERRORS_H__
#include <glib.h>
#define WINTC_GENERAL_ERROR wintc_general_error_quark()
/**
* Specifies simple errors used by WinTC components.
*/
typedef enum
{
WINTC_GENERAL_ERROR_NOTIMPL /** The functionality is not implemented. */
} WinTCGeneralError;
/**
* Displays a message box describing the error and clears the associated
* GError object.
*
* @param error A reference to the GError storage location.
*/
void wintc_display_error_and_clear(
GError** error
);
GQuark wintc_general_error_quark(void);
/**
* Logs a message describing the error and clears the associated GError
* object.
*
* @param error A reference to the GError storage location.
*/
void wintc_log_error_and_clear(
GError** error
);
/**
* Displays a message box describing the error in a nicer way, if possible, and
* clears the associated GError object.
*
* @param error A reference to the GError storage location.
*/
void wintc_nice_error_and_clear(
GError** error
);
#endif

100
shared/comgtk/public/list.h Normal file
View File

@@ -0,0 +1,100 @@
/** @file */
#ifndef __COMGTK_LIST_H__
#define __COMGTK_LIST_H__
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
/**
* Appends an item to the end of a list, if an item of equal value already
* exists in the list it will be removed and freed.
*
* @param list The list.
* @param data The item to append.
* @param comparer The function for comparing existing items to the new one.
* @param free_func The function for freeing an item, if necessary.
* @return The list.
*/
GList* wintc_list_distinct_append(
GList* list,
gpointer data,
GCompareFunc comparer,
GDestroyNotify free_func
);
/**
* Inserts an item at a specific index to a list, if an item of equal value
* already exists in the list it will be removed and freed.
*
* @param list The list.
* @param data The item to insert.
* @param position The index in the list, -1 to append to the end of the list.
* @param comparer The function for comparing existing items to the new one.
* @param free_func The function for freeing an item, if necessary.
* @return The list.
*/
GList* wintc_list_distinct_insert(
GList* list,
gpointer data,
gint position,
GCompareFunc comparer,
GDestroyNotify free_func
);
/**
* Prepends an item at the start of a list, if an item of equal value already
* exists in the list it will be removed and freed.
*
* @param list The list.
* @param data The item to prepend.
* @param comparer The function for comparing existing items to the new one.
* @param free_func The function for freeing an item, if necessary.
* @return The list.
*/
GList* wintc_list_distinct_prepend(
GList* list,
gpointer data,
GCompareFunc comparer,
GDestroyNotify free_func
);
/**
* Joins all strings together in the list into one single string.
*
* @param list The list.
* @return The compiled string.
*/
gchar* wintc_list_implode_strings(
GList* list
);
/**
* Clamps the size of a list, removing and freeing items that exist beyond that
* limit.
*
* @param list The list.
* @param limit The max items in the list.
* @param free_func The function for freeing an item, if necessary.
* @return The list.
*/
GList* wintc_list_limit(
GList* list,
gint limit,
GDestroyNotify free_func
);
/**
* Creates a list out of the lines in a string.
*
* @param str The string.
* @return The newly created list whose contents are the lines of the string.
*/
GList* wintc_list_read_from_string(
const gchar* str
);
#endif

View File

@@ -1,5 +1,7 @@
#ifndef __MARSHAL_H__
#define __MARSHAL_H__
/** @file */
#ifndef __COMGTK_MARSHAL_H__
#define __COMGTK_MARSHAL_H__
#include <glib.h>
#include <gtk/gtk.h>
@@ -7,6 +9,11 @@
//
// PUBLIC FUNCTIONS
//
/**
* A GClosureMarshal function for use with signals with handlers that take no
* arguments and return a boolean.
*/
void wintc_cclosure_marshal_BOOLEAN__VOID(
GClosure* closure,
GValue* return_value,
@@ -16,6 +23,10 @@ void wintc_cclosure_marshal_BOOLEAN__VOID(
gpointer marshal_data
);
/**
* A GClosureMarshal function for use with signals with handlers that take no
* arguments and return an integer.
*/
void wintc_cclosure_marshal_INT__VOID(
GClosure* closure,
GValue* return_value,

View File

@@ -0,0 +1,30 @@
/** @file */
#ifndef __COMGTK_MSGBOX_H__
#define __COMGTK_MSGBOX_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
/**
* Displays a message box with specified options.
*
* @param parent The parent window of the dialog.
* @param text The message to display.
* @param caption The title of the dialog.
* @param buttons The available buttons.
* @param type The type of message being displayed.
* @return The choice the user made in the dialog.
*/
gint wintc_messagebox_show(
GtkWindow* parent,
const gchar* text,
const gchar* caption,
GtkButtonsType buttons,
GtkMessageType type
);
#endif

View File

@@ -0,0 +1,80 @@
/** @file */
#ifndef __COMGTK_PROFILE_H__
#define __COMGTK_PROFILE_H__
#include <glib.h>
/**
* @def WINTC_COMPONENT_SHELL
* The identifier for the shell component.
*/
#define WINTC_COMPONENT_SHELL "shell"
//
// PUBLIC FUNCTIONS
//
/**
* Ensures that the directory structure for a component's data exists in the
* user's profile.
*
* @param component The component's identifier.
* @param out_error Storage location for any error that occurred.
* @return True if the directory structure exists.
*/
gboolean wintc_profile_ensure_exists(
const gchar* component,
GError** out_error
);
/**
* Constructs the absolute path for the location of a component's data in the
* user's profile.
*
* @param component The component's identifier.
* @param filename The name of the file in the profile.
* @return The absolute path for the file in the user's profile.
*/
gchar* wintc_profile_get_path(
const gchar* component,
const gchar* filename
);
/**
* Retrieves the contents of a file in the user's profile.
*
* @param component The component's identifier.
* @param filename The name of the file in the profile.
* @param contents Storage location for the file contents.
* @param length Storage location for the size of the file.
* @param error Storage location for any error that occurred.
* @return True if the file was successfully read.
*/
gboolean wintc_profile_get_file_contents(
const gchar* component,
const gchar* filename,
gchar** contents,
gsize* length,
GError** error
);
/**
* Writes contents to a file in the user's profile.
*
* @param component The component's identifier.
* @param filename The name of the file in the profile.
* @param contents The contents to write.
* @param length The length of the contents, -1 for NULL terminated.
* @param error Storage location for any error that occurred.
* @return True if the file was successfully written.
*/
gboolean wintc_profile_set_file_contents(
const gchar* component,
const gchar* filename,
gchar* contents,
gssize length,
GError** error
);
#endif

View File

@@ -0,0 +1,27 @@
/** @file */
#ifndef __COMGTK_SHORTHAND_H__
#define __COMGTK_SHORTHAND_H__
/**
* @def WINTC_SAFE_REF_CLEAR(ref)
*
* Sets the value pointed at by ref to NULL, checks ref itself is not NULL.
*/
#define WINTC_SAFE_REF_CLEAR(ref) if (ref != NULL) { *ref = NULL; }
/**
* @def WINTC_SAFE_REF_SET(ref)
*
* Sets the value pointed at by ref, checks ref itself is not NULL.
*/
#define WINTC_SAFE_REF_SET(ref, value) if (ref != NULL) { *ref = value; }
/**
* @def WINTC_UNUSED(arg)
*
* Marks a parameter as unused to the compiler so it doesn't complain.
*/
#define WINTC_UNUSED(arg) __attribute__((unused)) arg
#endif

View File

@@ -0,0 +1,28 @@
/** @file */
#ifndef __COMGTK_SIGNALS_H__
#define __COMGTK_SIGNALS_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
/**
* Connects a callback to a signals on many widgets at once.
*
* @param widgets The list of widgets.
* @param signal_name The signal name.
* @param cb The callback to connect.
* @param user_data Data that will be passed to the callback.
*/
void wintc_signal_connect_list(
GList* widgets,
const gchar* signal_name,
GCallback cb,
gpointer user_data
);
#endif

View File

@@ -0,0 +1,74 @@
/** @file */
#ifndef __COMGTK_STRINGS_H__
#define __COMGTK_STRINGS_H__
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
/**
* Copies a string, ensuring it has the specified prefix.
*
* @param str The string.
* @param prefix The desired prefix.
* @return The new string.
*/
gchar* wintc_str_set_prefix(
const gchar* str,
const gchar* prefix
);
/**
* Copies a string, ensuring it has the specified suffix.
*
* @param str The string.
* @param suffix The desired suffix.
* @return The new string.
*/
gchar* wintc_str_set_suffix(
const gchar* str,
const gchar* suffix
);
/**
* Counts the number of time a string appears within another string.
*
* @param haystack The subject string.
* @param needle The string to search for.
* @return The number of times the string appears.
*/
gint wintc_strstr_count(
const gchar* haystack,
const gchar* needle
);
/**
* Transfers a string between two pointers - if the destination pointer already
* refers to a string it will be freed.
*
* @param dest Reference to the destination pointer.
* @param src Reference to the source pointer.
*/
void wintc_strsteal(
gchar** dest,
gchar** src
);
/**
* Finds and replaces appearances of a string with another string.
*
* @param str The subject string.
* @param findwhat The string to find.
* @param replacewith The string to use as the replacement.
* @return A new string with the replacements.
*/
gchar* wintc_strsubst(
const gchar* str,
const gchar* findwhat,
const gchar* replacewith
);
#endif

View File

@@ -0,0 +1,34 @@
/** @file */
#ifndef __COMGTK_STYLES_H__
#define __COMGTK_STYLES_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
/**
* Adds application priority CSS to the specified widget.
*
* @param widget The widget.
* @param css The CSS to add, which will have application priority.
*/
void wintc_widget_add_css(
GtkWidget* widget,
const gchar* css
);
/**
* Adds a style class to the specified widget.
*
* @param widget The widget.
* @param class_name The style class.
*/
void wintc_widget_add_style_class(
GtkWidget* widget,
const gchar* class_name
);
#endif

View File

@@ -0,0 +1,26 @@
/** @file */
#ifndef __COMGTK_VERSION_H__
#define __COMGTK_VERSION_H__
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
/**
* Identifies whether the installed version of WinTC is a debug build.
*
* @return True if WinTC is a debug build.
*/
gboolean wintc_build_is_debug(void);
/**
* Retrieves the build tag identifying the installed version of WinTC.
*
* @return The WinTC build tag (caller is responsible for freeing).
*/
gchar* wintc_build_get_tag(void);
#endif

View File

@@ -0,0 +1,21 @@
/** @file */
#ifndef __COMGTK_WINDOW_H__
#define __COMGTK_WINDOW_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
/**
* Requests that a window be given focus.
*
* @param window The window.
*/
void wintc_focus_window(
GtkWindow* window
);
#endif

View File

@@ -1,251 +0,0 @@
#ifndef __WINTC_COMGTK_H__
#define __WINTC_COMGTK_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// Assets-related
//
#define WINTC_ASSETS_DIR "@CMAKE_INSTALL_PREFIX@/@WINTC_ASSETS_INSTALL_DIR@"
//
// Container-related
//
void wintc_gtk_container_clear(
GtkContainer* container
);
//
// Debugging
//
#define WINTC_ENVVAR_DEBUG_LOGGING "WINDEBUG"
#define WINTC_LOG_USER_DEBUG(...) if (getenv(WINTC_ENVVAR_DEBUG_LOGGING)) { g_message(__VA_ARGS__); }
#ifdef WINTC_CHECKED
#define WINTC_LOG_DEBUG(...) g_message(__VA_ARGS__);
#else
#define WINTC_LOG_DEBUG(...)
#endif
//
// Shorthand
//
#define WINTC_SAFE_REF_CLEAR(ref) if (ref != NULL) { *ref = NULL; }
#define WINTC_SAFE_REF_SET(ref, value) if (ref != NULL) { *ref = value; }
#define WINTC_UNUSED(arg) __attribute__((unused)) arg
//
// gchar-related
//
#define WINTC_GCHAR_BUFFER_SIZE sizeof(gchar) * 255
//
// Default procedures
//
void wintc_menu_shell_deselect_on_leave(
GtkWidget* widget,
WINTC_UNUSED(GdkEvent* event),
GtkMenuShell* menu_shell
);
void wintc_menu_shell_select_on_enter(
GtkWidget* widget,
WINTC_UNUSED(GdkEvent* event),
GtkMenuShell* menu_shell
);
//
// Error-related
//
#define WINTC_GENERAL_ERROR wintc_general_error_quark()
typedef enum
{
WINTC_GENERAL_ERROR_NOTIMPL
} WinTCGeneralError;
void wintc_display_error_and_clear(
GError** error
);
GQuark wintc_general_error_quark(void);
void wintc_log_error_and_clear(
GError** error
);
void wintc_nice_error_and_clear(
GError** error
);
//
// List-related
//
GList* wintc_list_distinct_append(
GList* list,
gpointer data,
GCompareFunc comparer,
GDestroyNotify free_func
);
GList* wintc_list_distinct_insert(
GList* list,
gpointer data,
gint position,
GCompareFunc comparer,
GDestroyNotify free_func
);
GList* wintc_list_distinct_prepend(
GList* list,
gpointer data,
GCompareFunc comparer,
GDestroyNotify free_func
);
gchar* wintc_list_implode_strings(
GList* list
);
GList* wintc_list_limit(
GList* list,
gint limit,
GDestroyNotify free_func
);
GList* wintc_list_read_from_string(
const gchar* str
);
//
// Closure Marshals
//
void wintc_cclosure_marshal_BOOLEAN__VOID(
GClosure* closure,
GValue* return_value,
guint n_param_values,
const GValue* param_values,
gpointer invocation_hint,
gpointer marshal_data
);
void wintc_cclosure_marshal_INT__VOID(
GClosure* closure,
GValue* return_value,
guint n_param_values,
const GValue* param_values,
gpointer invocation_hint,
gpointer marshal_data
);
//
// Message Box-related
//
gint wintc_messagebox_show(
GtkWindow* parent,
const gchar* text,
const gchar* caption,
GtkButtonsType buttons,
GtkMessageType type
);
//
// Profile-related
//
#define WINTC_COMPONENT_SHELL "shell"
gboolean wintc_profile_ensure_exists(
const gchar* component,
GError** out_error
);
gchar* wintc_profile_get_path(
const gchar* component,
const gchar* filename
);
gboolean wintc_profile_get_file_contents(
const gchar* component,
const gchar* filename,
gchar** contents,
gsize* length,
GError** error
);
gboolean wintc_profile_set_file_contents(
const gchar* component,
const gchar* filename,
gchar* contents,
gssize length,
GError** error
);
//
// Signal-related
//
void wintc_signal_connect_list(
GList* widgets,
const gchar* signal_name,
GCallback cb,
gpointer user_data
);
//
// Strings-related
//
gchar* wintc_str_set_prefix(
const gchar* str,
const gchar* prefix
);
gchar* wintc_str_set_suffix(
const gchar* str,
const gchar* suffix
);
gint wintc_strstr_count(
const gchar* haystack,
const gchar* needle
);
void wintc_strsteal(
gchar** dest,
gchar** src
);
gchar* wintc_strsubst(
const gchar* str,
const gchar* findwhat,
const gchar* replacewith
);
//
// Styles-related
//
void wintc_widget_add_css(
GtkWidget* widget,
const gchar* css
);
void wintc_widget_add_style_class(
GtkWidget* widget,
const gchar* class_name
);
//
// Version-related
//
gboolean wintc_build_is_debug();
gchar* wintc_get_build_tag(void);
//
// Window-related
//
void wintc_focus_window(
GtkWindow* window
);
#endif

View File

@@ -1,6 +0,0 @@
#ifndef __ASSETS_H__
#define __ASSETS_H__
#define WINTC_ASSETS_DIR "@CMAKE_INSTALL_PREFIX@/@WINTC_ASSETS_INSTALL_DIR@"
#endif

View File

@@ -1,12 +1,12 @@
#include <glib.h>
#include <gtk/gtk.h>
#include "container.h"
#include "../public/container.h"
//
// PUBLIC FUNCTIONS
//
void wintc_gtk_container_clear(
void wintc_container_clear(
GtkContainer* container
)
{

View File

@@ -1,13 +0,0 @@
#ifndef __CONTAINER_H__
#define __CONTAINER_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
void wintc_gtk_container_clear(
GtkContainer* container
);
#endif

View File

@@ -1,18 +0,0 @@
#ifndef __DEBUG_H__
#define __DEBUG_H__
// Two variants for debug messaging are provided:
// USER_DEBUG is at runtime, intended at end user debugging
// DEBUG is compile time, intended for development
//
#define WINTC_ENVVAR_DEBUG_LOGGING "WINDEBUG"
#define WINTC_LOG_USER_DEBUG(...) if (getenv(WINTC_ENVVAR_DEBUG_LOGGING)) { g_message(__VA_ARGS__); }
#ifdef WINTC_CHECKED
#define WINTC_LOG_DEBUG(...) g_message(__VA_ARGS__);
#else
#define WINTC_LOG_DEBUG(...)
#endif
#endif

View File

@@ -1,8 +1,8 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include "defprocs.h"
#include "shorthand.h"
#include "../public/defprocs.h"
#include "../public/shorthand.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,8 +1,8 @@
#include <glib.h>
#include <gtk/gtk.h>
#include "errors.h"
#include "msgbox.h"
#include "../public/errors.h"
#include "../public/msgbox.h"
#define RETURN_IF_NO_ERROR(e) if (e == NULL || *e == NULL) { return; }

View File

@@ -1,27 +0,0 @@
#ifndef __ERRORS_H__
#define __ERRORS_H__
#include <glib.h>
#define WINTC_GENERAL_ERROR wintc_general_error_quark()
typedef enum
{
WINTC_GENERAL_ERROR_NOTIMPL
} WinTCGeneralError;
void wintc_display_error_and_clear(
GError** error
);
GQuark wintc_general_error_quark(void);
void wintc_log_error_and_clear(
GError** error
);
void wintc_nice_error_and_clear(
GError** error
);
#endif

View File

@@ -1,6 +0,0 @@
#ifndef __GCHAR_H__
#define __GCHAR_H__
#define WINTC_GCHAR_BUFFER_SIZE sizeof(gchar) * 255
#endif

View File

@@ -1,6 +1,6 @@
#include <glib.h>
#include "list.h"
#include "../public/list.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,43 +0,0 @@
#ifndef __LIST_H__
#define __LIST_H__
//
// PUBLIC FUNCTIONS
//
GList* wintc_list_distinct_append(
GList* list,
gpointer data,
GCompareFunc comparer,
GDestroyNotify free_func
);
GList* wintc_list_distinct_insert(
GList* list,
gpointer data,
gint position,
GCompareFunc comparer,
GDestroyNotify free_func
);
GList* wintc_list_distinct_prepend(
GList* list,
gpointer data,
GCompareFunc comparer,
GDestroyNotify free_func
);
gchar* wintc_list_implode_strings(
GList* list
);
GList* wintc_list_limit(
GList* list,
gint limit,
GDestroyNotify free_func
);
GList* wintc_list_read_from_string(
const gchar* str
);
#endif

View File

@@ -1,8 +1,8 @@
#include <glib.h>
#include <gtk/gtk.h>
#include "marshal.h"
#include "shorthand.h"
#include "../public/marshal.h"
#include "../public/shorthand.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,6 +1,6 @@
#include <gtk/gtk.h>
#include "msgbox.h"
#include "../public/msgbox.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,17 +0,0 @@
#ifndef __MSGBOX_H__
#define __MSGBOX_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
gint wintc_messagebox_show(
GtkWindow* parent,
const gchar* text,
const gchar* caption,
GtkButtonsType buttons,
GtkMessageType type
);
#endif

View File

@@ -1,8 +1,8 @@
#include <errno.h>
#include <glib.h>
#include "profile.h"
#include "shorthand.h"
#include "../public/profile.h"
#include "../public/shorthand.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,37 +0,0 @@
#ifndef __PROFILE_H__
#define __PROFILE_H__
#include <glib.h>
#define WINTC_COMPONENT_SHELL "shell"
//
// PUBLIC FUNCTIONS
//
gboolean wintc_profile_ensure_exists(
const gchar* component,
GError** out_error
);
gchar* wintc_profile_get_path(
const gchar* component,
const gchar* filename
);
gboolean wintc_profile_get_file_contents(
const gchar* component,
const gchar* filename,
gchar** contents,
gsize* length,
GError** error
);
gboolean wintc_profile_set_file_contents(
const gchar* component,
const gchar* filename,
gchar* contents,
gssize length,
GError** error
);
#endif

View File

@@ -1,9 +0,0 @@
#ifndef __SHORTHAND_H__
#define __SHORTHAND_H__
#define WINTC_SAFE_REF_CLEAR(ref) if (ref != NULL) { *ref = NULL; }
#define WINTC_SAFE_REF_SET(ref, value) if (ref != NULL) { *ref = value; }
#define WINTC_UNUSED(arg) __attribute__((unused)) arg
#endif

View File

@@ -1,7 +1,7 @@
#include <glib.h>
#include <gtk/gtk.h>
#include "signals.h"
#include "../public/signals.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,17 +0,0 @@
#ifndef __SIGNALS_H__
#define __SIGNALS_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
void wintc_signal_connect_list(
GList* widgets,
const gchar* signal_name,
GCallback cb,
gpointer user_data
);
#endif

View File

@@ -1,7 +1,7 @@
#include <glib.h>
#include <string.h>
#include "strings.h"
#include "../public/strings.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,35 +0,0 @@
#ifndef __STRINGS_H__
#define __STRINGS_H__
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
gchar* wintc_str_set_prefix(
const gchar* str,
const gchar* prefix
);
gchar* wintc_str_set_suffix(
const gchar* str,
const gchar* suffix
);
gint wintc_strstr_count(
const gchar* haystack,
const gchar* needle
);
void wintc_strsteal(
gchar** dest,
gchar** src
);
gchar* wintc_strsubst(
const gchar* str,
const gchar* findwhat,
const gchar* replacewith
);
#endif

View File

@@ -1,6 +1,6 @@
#include <gtk/gtk.h>
#include "styles.h"
#include "../public/styles.h"
//
// PUBLIC FUNCIONS

View File

@@ -1,19 +0,0 @@
#ifndef __STYLES_H__
#define __STYLES_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
void wintc_widget_add_css(
GtkWidget* widget,
const gchar* css
);
void wintc_widget_add_style_class(
GtkWidget* widget,
const gchar* class_name
);
#endif

View File

@@ -1,4 +1,6 @@
#include "version.h"
#include <glib.h>
#include "../public/version.h"
//
// PUBLIC FUNCTIONS
@@ -12,7 +14,7 @@ gboolean wintc_build_is_debug(void)
#endif
}
gchar* wintc_get_build_tag(void)
gchar* wintc_build_get_tag(void)
{
gchar* build_tag = NULL;

View File

@@ -1,12 +0,0 @@
#ifndef __VERSION_H__
#define __VERSION_H__
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
gboolean wintc_build_is_debug(void);
gchar* wintc_get_build_tag(void);
#endif

View File

@@ -1,7 +1,7 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include "window.h"
#include "../public/window.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,13 +0,0 @@
#ifndef __WINDOW_H__
#define __WINDOW_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
void wintc_focus_window(
GtkWindow* window
);
#endif

View File

@@ -28,20 +28,19 @@ wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
add_library(
libwintc-exec
src/action.h
public/action.h
src/action.c
src/desktop.h
public/desktop.h
src/desktop.c
src/exec.h
public/exec.h
src/exec.c
src/mime.h
public/mime.h
src/mime.c
)
set_target_properties(
libwintc-exec
PROPERTIES
PUBLIC_HEADER public/wintc-exec.h
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
@@ -84,9 +83,9 @@ target_link_libraries(
#
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
wintc_install_public_headers()
install(
TARGETS libwintc-exec
LIBRARY DESTINATION ${LIB_DIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${LIB_DIR}
)

View File

@@ -0,0 +1,9 @@
#ifndef __WINTC_EXEC_H__
#define __WINTC_EXEC_H__
#include "exec/action.h"
#include "exec/desktop.h"
#include "exec/exec.h"
#include "exec/mime.h"
#endif

View File

@@ -0,0 +1,63 @@
/** @file */
#ifndef __EXEC_ACTIONS_H__
#define __EXEC_ACTIONS_H__
#include <glib.h>
//
// PUBLIC ENUMS
//
/**
* Specifies actions common to WinTC that can be launched.
*/
typedef enum
{
/** Opens the 'My Documents' folder. */
WINTC_ACTION_MYDOCS,
/** Opens the 'My Recent Documents' view. */
WINTC_ACTION_MYRECENTS,
/** Opens the 'My Pictures' folder. */
WINTC_ACTION_MYPICS,
/** Opens the 'My Music' folder. */
WINTC_ACTION_MYMUSIC,
/** Opens the 'My Computer' folder. */
WINTC_ACTION_MYCOMP,
/** Opens Control Panel. */
WINTC_ACTION_CONTROL,
/** Opens the program for managing MIME types. */
WINTC_ACTION_MIMEMGMT,
/** Opens the program for managing connections. */
WINTC_ACTION_CONNECTTO,
/** Opens the program for managing printers. */
WINTC_ACTION_PRINTERS,
/** Opens the program for getting help.*/
WINTC_ACTION_HELP,
/** Opens the program for performing searches. */
WINTC_ACTION_SEARCH,
/** Opens the 'Run' dialog. */
WINTC_ACTION_RUN,
/** Opens the user actions dialog. */
WINTC_ACTION_LOGOFF,
/** Opens the power options dialog. */
WINTC_ACTION_SHUTDOWN
} WinTCAction;
//
// PUBLIC FUNCTIONS
//
/**
* Launches the specified action.
*
* @param action_id The action.
* @param out_error Storage location for any error that occurred.
* @return True if the action was launched successfully.
*/
gboolean wintc_launch_action(
WinTCAction action_id,
GError** out_error
);
#endif

View File

@@ -0,0 +1,41 @@
/** @file */
#ifndef __EXEC_DESKTOP_H__
#define __EXEC_DESKTOP_H__
#include <gio/gdesktopappinfo.h>
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
/**
* Retrieves the command line from a desktop entry.
*
* @param entry The desktop entry.
* @return The command line.
*/
gchar* wintc_desktop_app_info_get_command(
GDesktopAppInfo* entry
);
/**
* Fills in the placeholders in a desktop entry's command line.
*
* @param cmdline The command line.
* @param name The translated name of the program.
* @param icon_name The icon name.
* @param entry_path The path to the desktop entry.
* @param needs_terminal Specifies if the program requires a terminal.
* @return The expanded command line.
*/
gchar* wintc_expand_desktop_entry_cmdline(
const gchar* cmdline,
const gchar* name,
const gchar* icon_name,
const gchar* entry_path,
gboolean needs_terminal
);
#endif

24
shared/exec/public/exec.h Normal file
View File

@@ -0,0 +1,24 @@
/** @file */
#ifndef __EXEC_EXEC_H__
#define __EXEC_EXEC_H__
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
/**
* Launches the specified command line.
*
* @param command The command line.
* @param out_error Storage location for any error that occurred.
* @return True if the command was launched successfully.
*/
gboolean wintc_launch_command(
const gchar* command,
GError** out_error
);
#endif

38
shared/exec/public/mime.h Normal file
View File

@@ -0,0 +1,38 @@
/** @file */
#ifndef __EXEC_MIME_H__
#define __EXEC_MIME_H__
#include <gio/gdesktopappinfo.h>
#include <glib.h>
//
// PUBLIC FUNCTIONS
//
/**
* Queries for the MIME type of the specified file.
*
* @param filepath The absolute path to the file.
* @param out_error Storage location for any error that occurred.
* @return The MIME type of the file, if one was detected.
*/
gchar* wintc_query_mime_for_file(
const gchar* filepath,
GError** out_error
);
/**
* Queries for the program that is set as the default for opening resources
* of the specified MIME type.
*
* @param mime_query The MIME type.
* @param out_error Storage location for any error that occurred.
* @return A GDesktopAppInfo instance that represents the program.
*/
GDesktopAppInfo* wintc_query_mime_handler(
const gchar* mime_query,
GError** out_error
);
#endif

View File

@@ -1,69 +0,0 @@
#ifndef __WINTC_EXEC_H__
#define __WINTC_EXEC_H__
#include <gio/gdesktopappinfo.h>
#include <glib.h>
//
// Actions
//
typedef enum
{
WINTC_ACTION_MYDOCS,
WINTC_ACTION_MYRECENTS,
WINTC_ACTION_MYPICS,
WINTC_ACTION_MYMUSIC,
WINTC_ACTION_MYCOMP,
WINTC_ACTION_CONTROL,
WINTC_ACTION_MIMEMGMT,
WINTC_ACTION_CONNECTTO,
WINTC_ACTION_PRINTERS,
WINTC_ACTION_HELP,
WINTC_ACTION_SEARCH,
WINTC_ACTION_RUN,
WINTC_ACTION_LOGOFF,
WINTC_ACTION_SHUTDOWN
} WinTCAction;
gboolean wintc_launch_action(
WinTCAction action_id,
GError** out_error
);
//
// Desktop entries
//
gchar* wintc_desktop_app_info_get_command(
GDesktopAppInfo* entry
);
gchar* wintc_expand_desktop_entry_cmdline(
const gchar* cmdline,
const gchar* name,
const gchar* icon_name,
const gchar* entry_path,
gboolean needs_terminal
);
//
// Execution
//
gboolean wintc_launch_command(
const gchar* command,
GError** out_error
);
//
// MIME types
//
gchar* wintc_query_mime_for_file(
const gchar* filepath,
GError** out_error
);
GDesktopAppInfo* wintc_query_mime_handler(
const gchar* mime_query,
GError** out_error
);
#endif

View File

@@ -1,8 +1,8 @@
#include <glib.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "action.h"
#include "exec.h"
#include "../public/action.h"
#include "../public/exec.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,29 +0,0 @@
#ifndef __ACTIONS_H__
#define __ACTIONS_H__
#include <glib.h>
typedef enum
{
WINTC_ACTION_MYDOCS,
WINTC_ACTION_MYRECENTS,
WINTC_ACTION_MYPICS,
WINTC_ACTION_MYMUSIC,
WINTC_ACTION_MYCOMP,
WINTC_ACTION_CONTROL,
WINTC_ACTION_MIMEMGMT,
WINTC_ACTION_CONNECTTO,
WINTC_ACTION_PRINTERS,
WINTC_ACTION_HELP,
WINTC_ACTION_SEARCH,
WINTC_ACTION_RUN,
WINTC_ACTION_LOGOFF,
WINTC_ACTION_SHUTDOWN
} WinTCAction;
gboolean wintc_launch_action(
WinTCAction action_id,
GError** out_error
);
#endif

View File

@@ -1,7 +1,7 @@
#include <gio/gdesktopappinfo.h>
#include <glib.h>
#include "desktop.h"
#include "../public/desktop.h"
//
// PUBLIC FUNCTIONS
@@ -53,7 +53,7 @@ gchar* wintc_expand_desktop_entry_cmdline(
{
g_string_append(
expanded,
"exo-open --launch TerminalEmulator"
"exo-open --launch TerminalEmulator "
);
}
@@ -84,9 +84,10 @@ gchar* wintc_expand_desktop_entry_cmdline(
case 'i':
if (icon_name != NULL)
{
g_string_append(
g_string_append_printf(
expanded,
name
"--icon %s",
icon_name
);
}

View File

@@ -1,19 +0,0 @@
#ifndef __DESKTOP_H__
#define __DESKTOP_H__
#include <gio/gdesktopappinfo.h>
#include <glib.h>
gchar* wintc_desktop_app_info_get_command(
GDesktopAppInfo* entry
);
gchar* wintc_expand_desktop_entry_cmdline(
const gchar* cmdline,
const gchar* name,
const gchar* icon_name,
const gchar* entry_path,
gboolean needs_terminal
);
#endif

View File

@@ -2,11 +2,11 @@
#include <gio/gdesktopappinfo.h>
#include <glib.h>
#include <sys/wait.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "desktop.h"
#include "mime.h"
#include "exec.h"
#include "../public/desktop.h"
#include "../public/mime.h"
#include "../public/exec.h"
//
// LOCAL TYPEDEFS

View File

@@ -1,11 +0,0 @@
#ifndef __EXEC_H__
#define __EXEC_H__
#include <glib.h>
gboolean wintc_launch_command(
const gchar* command,
GError** out_error
);
#endif

View File

@@ -1,9 +1,9 @@
#include <gio/gdesktopappinfo.h>
#include <glib.h>
#include <sys/wait.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "mime.h"
#include "../public/mime.h"
//
// PUBLIC FUNCTIONS

View File

@@ -1,17 +0,0 @@
#ifndef __MIME_H__
#define __MIME_H__
#include <gio/gdesktopappinfo.h>
#include <glib.h>
gchar* wintc_query_mime_for_file(
const gchar* filepath,
GError** out_error
);
GDesktopAppInfo* wintc_query_mime_handler(
const gchar* mime_query,
GError** out_error
);
#endif

View File

@@ -35,11 +35,11 @@ add_library(
libwintc-msgina
src/resources.c
src/authwnd.c
src/authwnd.h
src/challenge.h
public/authwnd.h
public/challenge.h
src/logon.c
src/logon.h
src/state.h
public/logon.h
public/state.h
src/stripctl.c
src/stripctl.h
)
@@ -47,7 +47,6 @@ add_library(
set_target_properties(
libwintc-msgina
PROPERTIES
PUBLIC_HEADER public/wintc-msgina.h
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
@@ -96,9 +95,9 @@ target_link_libraries(
#
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
wintc_install_public_headers()
install(
TARGETS libwintc-msgina
LIBRARY DESTINATION ${LIB_DIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${LIB_DIR}
)

View File

@@ -0,0 +1,9 @@
#ifndef __WINTC_MSGINA_H__
#define __WINTC_MSGINA_H__
#include "msgina/authwnd.h"
#include "msgina/challenge.h"
#include "msgina/logon.h"
#include "msgina/state.h"
#endif

View File

@@ -0,0 +1,40 @@
/** @file */
#ifndef __MSGINA_AUTHWND_H__
#define __MSGINA_AUTHWND_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// GTK OOP BOILERPLATE
//
typedef struct _WinTCGinaAuthWindowClass WinTCGinaAuthWindowClass;
/**
* A standard GINA authentication window.
*/
typedef struct _WinTCGinaAuthWindow WinTCGinaAuthWindow;
#define WINTC_TYPE_GINA_AUTH_WINDOW (wintc_gina_auth_window_get_type())
#define WINTC_GINA_AUTH_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WINTC_TYPE_GINA_AUTH_WINDOW, WinTCGinaAuthWindow))
#define WINTC_GINA_AUTH_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WINTC_TYPE_GINA_AUTH_WINDOW, WinTCGinaAuthWindow))
#define IS_WINTC_GINA_AUTH_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WINTC_TYPE_GINA_AUTH_WINDOW))
#define IS_WINTC_GINA_AUTH_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WINTC_TYPE_GINA_AUTH_WINDOW))
#define WINTC_GINA_WINDOW_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), WINTC_TYPE_GINA_AUTH_WINDOW))
GType wintc_gina_auth_window_get_type(void) G_GNUC_CONST;
//
// PUBLIC FUNCTIONS
//
/**
* Creates a new instance of WinTCGinaAuthWindow.
*
* @return The new WinTCGinaAuthWindow instance cast to GtkWidget.
*/
GtkWidget* wintc_gina_auth_window_new(void);
#endif

View File

@@ -0,0 +1,18 @@
/** @file */
#ifndef __MSGINA_CHALLENGE_H__
#define __MSGINA_CHALLENGE_H__
/**
* Specifies challenge response outcomes from GINA.
*/
typedef enum
{
/** The authetication attempt was successful. */
WINTC_GINA_RESPONSE_OKAY = 0,
/** The authentication attempt was a failure. */
WINTC_GINA_RESPONSE_FAIL = 1
} WinTCGinaResponse;
#endif

View File

@@ -0,0 +1,111 @@
/**
* @file
*
* This is the logon session object, which is the main mechanism in GINA for
* providing user logon.
*
* The underlying provider may be asynchonous so the functionality of the logon
* session object works via polling and signals.
*
* Straight forward usage is as follows:
* - Create the logon session object
* - Connect to the 'attempt-complete' signal - see attempt_complete_cb below
* - Call wintc_gina_logon_session_establish to initiate connection to the
* logon provider
* - Poll wintc_gina_logon_session_is_available to determine when it is
* ready
* - Call wintc_gina_logon_session_try_logon with user credentials
* - The 'attempt-complete' signal is raised:
* - If successful, call wintc_gina_logon_session_finish to complete logon
* - If unsuccessful, poll wintc_gina_logon_session_is_available again
*
* The callback for the 'attempt-complete' signal is as follows:
*
* void attempt_complete_cb(
* WinTCGinaLogonSession* logon_session,
* WinTCGinaResponse response,
* gpointer user_data
* )
*/
#ifndef __MSGINA_LOGON_H__
#define __MSGINA_LOGON_H__
#include <glib.h>
//
// GLIB BOILERPLATE
//
typedef struct _WinTCGinaLogonSessionClass WinTCGinaLogonSessionClass;
/**
* Represents a logon session for providing user authentication.
*/
typedef struct _WinTCGinaLogonSession WinTCGinaLogonSession;
#define WINTC_TYPE_GINA_LOGON_SESSION (wintc_gina_logon_session_get_type())
#define WINTC_GINA_LOGON_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WINTC_TYPE_GINA_LOGON_SESSION, WinTCGinaLogonSession))
#define WINTC_GINA_LOGON_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WINTC_TYPE_GINA_LOGON_SESSION, WinTCGinaLogonSession))
#define IS_WINTC_GINA_LOGON_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WINTC_TYPE_GINA_LOGON_SESSION))
#define IS_WINTC_GINA_LOGON_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WINTC_TYPE_GINA_LOGON_SESSION))
#define WINTC_GINA_LOGON_SESSION_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), WINTC_TYPE_GINA_LOGON_SESSION)
GType wintc_gina_logon_session_get_type(void) G_GNUC_CONST;
//
// PUBLIC FUNCTIONS
//
/**
* Creates a new instance of WinTCGinaLogonSession.
*
* @return The new WinTCGinaLogonSession instance.
*/
WinTCGinaLogonSession* wintc_gina_logon_session_new(void);
/**
* Establishes a connection to the underlying logon provider.
*
* @param logon_session The logon session.
* @return True if a connection was successfully established.
*/
gboolean wintc_gina_logon_session_establish(
WinTCGinaLogonSession* logon_session
);
/**
* Requests that the logon session be completed, following successful user
* authentication.
*
* @param logon_session The logon session.
*/
void wintc_gina_logon_session_finish(
WinTCGinaLogonSession* logon_session
);
/**
* Determines whether the logon session is ready for the user authentication
* stage.
*
* @param logon_session The logon session.
* @return True if user authentication is ready.
*/
gboolean wintc_gina_logon_session_is_available(
WinTCGinaLogonSession* logon_session
);
/**
* Attempt to authenticate as a user with their logon credentials.
*
* @param logon_session The logon session.
* @param username The account username.
* @param password The account password.
*/
void wintc_gina_logon_session_try_logon(
WinTCGinaLogonSession* logon_session,
const gchar* username,
const gchar* password
);
#endif

View File

@@ -0,0 +1,22 @@
/** @file */
#ifndef __MSGINA_STATE_H__
#define __MSGINA_STATE_H__
/**
* Specifies the possible states of a GINA logon provider.
*/
typedef enum
{
/** The provider has not even begun. */
WINTC_GINA_STATE_NONE = 0,
/** The provider is in the process of starting up. */
WINTC_GINA_STATE_STARTING,
/** The provider has displayed the user prompt and is awaiting input. */
WINTC_GINA_STATE_PROMPT,
/** The provider is in the process of launching the user session. */
WINTC_GINA_STATE_LAUNCHING
} WinTCGinaState;
#endif

View File

@@ -1,78 +0,0 @@
#ifndef __WINTC_MSGINA_H__
#define __WINTC_MSGINA_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// Authentication window
//
typedef struct _WinTCGinaAuthWindowPrivate WinTCGinaAuthWindowPrivate;
typedef struct _WinTCGinaAuthWindowClass WinTCGinaAuthWindowClass;
typedef struct _WinTCGinaAuthWindow WinTCGinaAuthWindow;
#define TYPE_WINTC_GINA_AUTH_WINDOW (wintc_gina_auth_window_get_type())
#define WINTC_GINA_AUTH_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_GINA_AUTH_WINDOW, WinTCGinaAuthWindow))
#define WINTC_GINA_AUTH_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_GINA_AUTH_WINDOW, WinTCGinaAuthWindow))
#define IS_WINTC_GINA_AUTH_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_GINA_AUTH_WINDOW))
#define IS_WINTC_GINA_AUTH_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_GINA_AUTH_WINDOW))
#define WINTC_GINA_WINDOW_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), TYPE_WINTC_GINA_AUTH_WINDOW))
GType wintc_gina_auth_window_get_type(void) G_GNUC_CONST;
GtkWidget* wintc_gina_auth_window_new(void);
//
// Challenge auth
//
typedef enum
{
WINTC_GINA_RESPONSE_OKAY = 0,
WINTC_GINA_RESPONSE_FAIL = 1
} WinTCGinaResponse;
//
// Logon session
//
typedef struct _WinTCGinaLogonSessionClass WinTCGinaLogonSessionClass;
typedef struct _WinTCGinaLogonSession WinTCGinaLogonSession;
#define TYPE_WINTC_GINA_LOGON_SESSION (wintc_gina_logon_session_get_type())
#define WINTC_GINA_LOGON_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_GINA_LOGON_SESSION, WinTCGinaLogonSession))
#define WINTC_GINA_LOGON_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_GINA_LOGON_SESSION, WinTCGinaLogonSession))
#define IS_WINTC_GINA_LOGON_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_GINA_LOGON_SESSION))
#define IS_WINTC_GINA_LOGON_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_GINA_LOGON_SESSION))
#define WINTC_GINA_LOGON_SESSION_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), TYPE_WINTC_GINA_LOGON_SESSION)
GType wintc_gina_logon_session_get_type(void) G_GNUC_CONST;
WinTCGinaLogonSession* wintc_gina_logon_session_new(void);
gboolean wintc_gina_logon_session_establish(
WinTCGinaLogonSession* logon_session
);
void wintc_gina_logon_session_finish(
WinTCGinaLogonSession* logon_session
);
gboolean wintc_gina_logon_session_is_available(
WinTCGinaLogonSession* logon_session
);
void wintc_gina_logon_session_try_logon(
WinTCGinaLogonSession* logon_session,
const gchar* username,
const gchar* password
);
//
// State
//
typedef enum
{
WINTC_GINA_STATE_NONE = 0,
WINTC_GINA_STATE_STARTING,
WINTC_GINA_STATE_PROMPT,
WINTC_GINA_STATE_LAUNCHING
} WinTCGinaState;
#endif

View File

@@ -2,14 +2,14 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc-comctl.h>
#include <wintc-comgtk.h>
#include <wintc-winbrand.h>
#include <wintc/comctl.h>
#include <wintc/comgtk.h>
#include <wintc/winbrand.h>
#include "authwnd.h"
#include "challenge.h"
#include "logon.h"
#include "state.h"
#include "../public/authwnd.h"
#include "../public/challenge.h"
#include "../public/logon.h"
#include "../public/state.h"
#include "stripctl.h"
#define DELAY_SECONDS_AT_LEAST 2
@@ -18,8 +18,15 @@
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
struct _WinTCGinaAuthWindowPrivate
struct _WinTCGinaAuthWindowClass
{
GtkWindowClass __parent__;
};
struct _WinTCGinaAuthWindow
{
GtkWindow __parent__;
// Image resources
//
GdkPixbuf* pixbuf_banner;
@@ -45,18 +52,6 @@ struct _WinTCGinaAuthWindowPrivate
WinTCGinaLogonSession* logon_session;
};
struct _WinTCGinaAuthWindowClass
{
GtkWindowClass __parent__;
};
struct _WinTCGinaAuthWindow
{
GtkWindow __parent__;
WinTCGinaAuthWindowPrivate* priv;
};
//
// FORWARD DECLARATIONS
//
@@ -95,11 +90,10 @@ static gboolean on_timeout_poll_ready(
//
// GTK TYPE DEFINITIONS & CTORS
//
G_DEFINE_TYPE_WITH_CODE(
G_DEFINE_TYPE(
WinTCGinaAuthWindow,
wintc_gina_auth_window,
GTK_TYPE_WINDOW,
G_ADD_PRIVATE(WinTCGinaAuthWindow)
GTK_TYPE_WINDOW
)
static void wintc_gina_auth_window_class_init(
@@ -125,25 +119,23 @@ static void wintc_gina_auth_window_class_init(
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK
);
wintc_comctl_install_default_styles();
wintc_ctl_install_default_styles();
}
static void wintc_gina_auth_window_init(
WinTCGinaAuthWindow* self
)
{
self->priv = wintc_gina_auth_window_get_instance_private(self);
// Acquire branding pixbufs
//
GError* err_banner = NULL;
GError* err_bannerx = NULL;
self->priv->pixbuf_banner = wintc_brand_get_brand_pixmap(
self->pixbuf_banner = wintc_brand_get_brand_pixmap(
WINTC_BRAND_PART_BANNER,
&err_banner
);
self->priv->pixbuf_bannerx = wintc_brand_get_brand_pixmap(
self->pixbuf_bannerx = wintc_brand_get_brand_pixmap(
WINTC_BRAND_PART_BANNER_TALL,
&err_bannerx
);
@@ -155,22 +147,22 @@ static void wintc_gina_auth_window_init(
//
GtkWidget* image_brand =
gtk_image_new_from_pixbuf(
self->priv->pixbuf_bannerx
self->pixbuf_bannerx
);
self->priv->box_brand = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->priv->strip = wintc_gina_strip_new();
self->box_brand = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->strip = wintc_gina_strip_new();
gtk_box_pack_start(
GTK_BOX(self->priv->box_brand),
GTK_BOX(self->box_brand),
image_brand,
FALSE,
FALSE,
0
);
gtk_box_pack_start(
GTK_BOX(self->priv->box_brand),
self->priv->strip,
GTK_BOX(self->box_brand),
self->strip,
FALSE,
FALSE,
0
@@ -180,10 +172,10 @@ static void wintc_gina_auth_window_init(
//
GtkWidget* label_wait = gtk_label_new("Please wait...");
self->priv->box_wait = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->box_wait = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
wintc_widget_add_style_class(
self->priv->box_wait,
self->box_wait,
"please-wait"
);
@@ -197,7 +189,7 @@ static void wintc_gina_auth_window_init(
);
gtk_box_pack_start(
GTK_BOX(self->priv->box_wait),
GTK_BOX(self->box_wait),
label_wait,
TRUE,
TRUE,
@@ -211,19 +203,19 @@ static void wintc_gina_auth_window_init(
GtkWidget* label_password = gtk_label_new("Password:");
GtkWidget* label_username = gtk_label_new("User name:");
self->priv->box_login = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->box_login = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->priv->button_submit = gtk_button_new_with_label("OK");
self->priv->entry_password = gtk_entry_new();
self->priv->entry_username = gtk_entry_new();
self->button_submit = gtk_button_new_with_label("OK");
self->entry_password = gtk_entry_new();
self->entry_username = gtk_entry_new();
wintc_widget_add_style_class(
box_buttons,
WINTC_COMCTL_BUTTON_BOX_CSS_CLASS
WINTC_CTL_BUTTON_BOX_CSS_CLASS
);
wintc_widget_add_style_class(
self->priv->box_login,
self->box_login,
"login"
);
@@ -236,10 +228,10 @@ static void wintc_gina_auth_window_init(
GTK_ALIGN_START
);
gtk_entry_set_visibility(GTK_ENTRY(self->priv->entry_password), FALSE);
gtk_entry_set_visibility(GTK_ENTRY(self->entry_password), FALSE);
g_signal_connect(
self->priv->button_submit,
self->button_submit,
"clicked",
G_CALLBACK(on_button_submit_clicked),
self
@@ -255,7 +247,7 @@ static void wintc_gina_auth_window_init(
);
gtk_grid_attach(
GTK_GRID(grid_login),
self->priv->entry_username,
self->entry_username,
1,
0,
1,
@@ -272,7 +264,7 @@ static void wintc_gina_auth_window_init(
);
gtk_grid_attach(
GTK_GRID(grid_login),
self->priv->entry_password,
self->entry_password,
1,
1,
1,
@@ -281,18 +273,18 @@ static void wintc_gina_auth_window_init(
gtk_box_pack_end(
GTK_BOX(box_buttons),
self->priv->button_submit,
self->button_submit,
FALSE,
FALSE,
0
);
gtk_container_add(
GTK_CONTAINER(self->priv->box_login),
GTK_CONTAINER(self->box_login),
grid_login
);
gtk_container_add(
GTK_CONTAINER(self->priv->box_login),
GTK_CONTAINER(self->box_login),
box_buttons
);
@@ -300,7 +292,7 @@ static void wintc_gina_auth_window_init(
//
GtkWidget* header_bar = gtk_header_bar_new();
self->priv->box_container = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
self->box_container = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_header_bar_set_title(
GTK_HEADER_BAR(header_bar),
@@ -308,13 +300,13 @@ static void wintc_gina_auth_window_init(
);
gtk_container_add(
GTK_CONTAINER(self->priv->box_container),
self->priv->box_brand
GTK_CONTAINER(self->box_container),
self->box_brand
);
gtk_container_add(
GTK_CONTAINER(self),
self->priv->box_container
self->box_container
);
gtk_window_set_titlebar(
@@ -325,8 +317,8 @@ static void wintc_gina_auth_window_init(
// Hold additional references to the boxes, so we can add/remove
// them ourselves without them getting binned
//
g_object_ref(self->priv->box_login);
g_object_ref(self->priv->box_wait);
g_object_ref(self->box_login);
g_object_ref(self->box_wait);
// Connect to realize signal to kick off everything when we're
// actually live
@@ -340,11 +332,11 @@ static void wintc_gina_auth_window_init(
// Set initial state
//
self->priv->current_state = WINTC_GINA_STATE_NONE;
self->priv->logon_session = wintc_gina_logon_session_new();
self->current_state = WINTC_GINA_STATE_NONE;
self->logon_session = wintc_gina_logon_session_new();
g_signal_connect(
self->priv->logon_session,
self->logon_session,
"attempt-complete",
G_CALLBACK(on_logon_session_attempt_complete),
self
@@ -360,13 +352,13 @@ static void wintc_gina_auth_window_finalize(
{
WinTCGinaAuthWindow* window = WINTC_GINA_AUTH_WINDOW(gobject);
g_clear_object(&(window->priv->pixbuf_banner));
g_clear_object(&(window->priv->pixbuf_bannerx));
g_clear_object(&(window->pixbuf_banner));
g_clear_object(&(window->pixbuf_bannerx));
// Bin additional references held for the boxes
//
g_clear_object(&(window->priv->box_login));
g_clear_object(&(window->priv->box_wait));
g_clear_object(&(window->box_login));
g_clear_object(&(window->box_wait));
(G_OBJECT_CLASS(wintc_gina_auth_window_parent_class))->finalize(gobject);
}
@@ -378,7 +370,7 @@ GtkWidget* wintc_gina_auth_window_new(void)
{
return GTK_WIDGET(
g_object_new(
TYPE_WINTC_GINA_AUTH_WINDOW,
WINTC_TYPE_GINA_AUTH_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"resizable", FALSE,
NULL
@@ -396,23 +388,23 @@ static void wintc_gina_auth_window_change_state(
{
// Disable current state, if any
//
switch (window->priv->current_state)
switch (window->current_state)
{
case WINTC_GINA_STATE_STARTING:
case WINTC_GINA_STATE_LAUNCHING:
wintc_gina_strip_stop_animating(
WINTC_GINA_STRIP(window->priv->strip)
WINTC_GINA_STRIP(window->strip)
);
gtk_container_remove(
GTK_CONTAINER(window->priv->box_container),
window->priv->box_wait
GTK_CONTAINER(window->box_container),
window->box_wait
);
break;
case WINTC_GINA_STATE_PROMPT:
gtk_container_remove(
GTK_CONTAINER(window->priv->box_container),
window->priv->box_login
GTK_CONTAINER(window->box_container),
window->box_login
);
break;
@@ -425,17 +417,17 @@ static void wintc_gina_auth_window_change_state(
{
case WINTC_GINA_STATE_STARTING:
gtk_box_pack_start(
GTK_BOX(window->priv->box_container),
window->priv->box_wait,
GTK_BOX(window->box_container),
window->box_wait,
TRUE,
TRUE,
0
);
wintc_gina_strip_animate(
WINTC_GINA_STRIP(window->priv->strip)
WINTC_GINA_STRIP(window->strip)
);
wintc_gina_logon_session_establish(
window->priv->logon_session
window->logon_session
);
g_timeout_add_seconds(
DELAY_SECONDS_AT_LEAST,
@@ -446,8 +438,8 @@ static void wintc_gina_auth_window_change_state(
case WINTC_GINA_STATE_PROMPT:
gtk_box_pack_start(
GTK_BOX(window->priv->box_container),
window->priv->box_login,
GTK_BOX(window->box_container),
window->box_login,
TRUE,
TRUE,
0
@@ -456,14 +448,14 @@ static void wintc_gina_auth_window_change_state(
case WINTC_GINA_STATE_LAUNCHING:
gtk_box_pack_start(
GTK_BOX(window->priv->box_container),
window->priv->box_wait,
GTK_BOX(window->box_container),
window->box_wait,
TRUE,
TRUE,
0
);
wintc_gina_strip_animate(
WINTC_GINA_STRIP(window->priv->strip)
WINTC_GINA_STRIP(window->strip)
);
g_timeout_add_seconds(
DELAY_SECONDS_AT_LEAST,
@@ -476,10 +468,10 @@ static void wintc_gina_auth_window_change_state(
}
gtk_widget_show_all(
window->priv->box_container
window->box_container
);
window->priv->current_state = next_state;
window->current_state = next_state;
}
//
@@ -516,29 +508,29 @@ static void on_logon_session_attempt_complete(
case WINTC_GINA_RESPONSE_FAIL:
// FIXME: Prompt for failure
gtk_entry_set_text(
GTK_ENTRY(window->priv->entry_password),
GTK_ENTRY(window->entry_password),
""
);
gtk_entry_set_text(
GTK_ENTRY(window->priv->entry_username),
GTK_ENTRY(window->entry_username),
""
);
gtk_widget_set_sensitive(
window->priv->button_submit,
window->button_submit,
TRUE
);
gtk_widget_set_sensitive(
window->priv->entry_password,
window->entry_password,
TRUE
);
gtk_widget_set_sensitive(
window->priv->entry_username,
window->entry_username,
TRUE
);
wintc_gina_strip_stop_animating(
WINTC_GINA_STRIP(window->priv->strip)
WINTC_GINA_STRIP(window->strip)
);
break;
@@ -555,26 +547,26 @@ static void on_button_submit_clicked(
WinTCGinaAuthWindow* window = WINTC_GINA_AUTH_WINDOW(user_data);
gtk_widget_set_sensitive(
window->priv->button_submit,
window->button_submit,
FALSE
);
gtk_widget_set_sensitive(
window->priv->entry_password,
window->entry_password,
FALSE
);
gtk_widget_set_sensitive(
window->priv->entry_username,
window->entry_username,
FALSE
);
wintc_gina_strip_animate(
WINTC_GINA_STRIP(window->priv->strip)
WINTC_GINA_STRIP(window->strip)
);
wintc_gina_logon_session_try_logon(
window->priv->logon_session,
gtk_entry_get_text(GTK_ENTRY(window->priv->entry_username)),
gtk_entry_get_text(GTK_ENTRY(window->priv->entry_password))
window->logon_session,
gtk_entry_get_text(GTK_ENTRY(window->entry_username)),
gtk_entry_get_text(GTK_ENTRY(window->entry_password))
);
}
@@ -584,7 +576,7 @@ static gboolean on_timeout_delay_done(
{
WinTCGinaAuthWindow* window = WINTC_GINA_AUTH_WINDOW(user_data);
switch (window->priv->current_state)
switch (window->current_state)
{
case WINTC_GINA_STATE_STARTING:
g_timeout_add_seconds(
@@ -596,7 +588,7 @@ static gboolean on_timeout_delay_done(
case WINTC_GINA_STATE_LAUNCHING:
wintc_gina_logon_session_finish(
window->priv->logon_session
window->logon_session
);
break;
@@ -616,7 +608,7 @@ static gboolean on_timeout_poll_ready(
if (
wintc_gina_logon_session_is_available(
window->priv->logon_session
window->logon_session
)
)
{

View File

@@ -1,29 +0,0 @@
#ifndef __AUTHWND_H__
#define __AUTHWND_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// GTK OOP BOILERPLATE
//
typedef struct _WinTCGinaAuthWindowPrivate WinTCGinaAuthWindowPrivate;
typedef struct _WinTCGinaAuthWindowClass WinTCGinaAuthWindowClass;
typedef struct _WinTCGinaAuthWindow WinTCGinaAuthWindow;
#define TYPE_WINTC_GINA_AUTH_WINDOW (wintc_gina_auth_window_get_type())
#define WINTC_GINA_AUTH_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_GINA_AUTH_WINDOW, WinTCGinaAuthWindow))
#define WINTC_GINA_AUTH_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_GINA_AUTH_WINDOW, WinTCGinaAuthWindow))
#define IS_WINTC_GINA_AUTH_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_GINA_AUTH_WINDOW))
#define IS_WINTC_GINA_AUTH_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_GINA_AUTH_WINDOW))
#define WINTC_GINA_WINDOW_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), TYPE_WINTC_GINA_AUTH_WINDOW))
GType wintc_gina_auth_window_get_type(void) G_GNUC_CONST;
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_gina_auth_window_new(void);
#endif

View File

@@ -1,11 +0,0 @@
#ifndef __CHALLENGE_H__
#define __CHALLENGE_H__
typedef enum
{
WINTC_GINA_RESPONSE_OKAY = 0,
WINTC_GINA_RESPONSE_FAIL = 1
} WinTCGinaResponse;
#endif

View File

@@ -1,9 +1,9 @@
#include <glib.h>
#include <lightdm.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "challenge.h"
#include "logon.h"
#include "../public/challenge.h"
#include "../public/logon.h"
//
// PRIVATE ENUMS
@@ -97,7 +97,7 @@ WinTCGinaLogonSession* wintc_gina_logon_session_new(void)
{
return WINTC_GINA_LOGON_SESSION(
g_object_new(
TYPE_WINTC_GINA_LOGON_SESSION,
WINTC_TYPE_GINA_LOGON_SESSION,
NULL
)
);

View File

@@ -1,42 +0,0 @@
#ifndef __LOGON_H__
#define __LOGON_H__
#include <glib.h>
//
// GLIB BOILERPLATE
//
typedef struct _WinTCGinaLogonSessionClass WinTCGinaLogonSessionClass;
typedef struct _WinTCGinaLogonSession WinTCGinaLogonSession;
#define TYPE_WINTC_GINA_LOGON_SESSION (wintc_gina_logon_session_get_type())
#define WINTC_GINA_LOGON_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_GINA_LOGON_SESSION, WinTCGinaLogonSession))
#define WINTC_GINA_LOGON_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_GINA_LOGON_SESSION, WinTCGinaLogonSession))
#define IS_WINTC_GINA_LOGON_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_GINA_LOGON_SESSION))
#define IS_WINTC_GINA_LOGON_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_GINA_LOGON_SESSION))
#define WINTC_GINA_LOGON_SESSION_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), TYPE_WINTC_GINA_LOGON_SESSION)
GType wintc_gina_logon_session_get_type(void) G_GNUC_CONST;
//
// PUBLIC FUNCTIONS
//
WinTCGinaLogonSession* wintc_gina_logon_session_new(void);
gboolean wintc_gina_logon_session_establish(
WinTCGinaLogonSession* logon_session
);
void wintc_gina_logon_session_finish(
WinTCGinaLogonSession* logon_session
);
gboolean wintc_gina_logon_session_is_available(
WinTCGinaLogonSession* logon_session
);
void wintc_gina_logon_session_try_logon(
WinTCGinaLogonSession* logon_session,
const gchar* username,
const gchar* password
);
#endif

View File

@@ -1,13 +0,0 @@
#ifndef __STATE_H__
#define __STATE_H__
typedef enum
{
WINTC_GINA_STATE_NONE = 0,
WINTC_GINA_STATE_STARTING,
WINTC_GINA_STATE_PROMPT,
WINTC_GINA_STATE_LAUNCHING
} WinTCGinaState;
#endif

View File

@@ -2,8 +2,8 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc-comgtk.h>
#include <wintc-winbrand.h>
#include <wintc/comgtk.h>
#include <wintc/winbrand.h>
#include "stripctl.h"
@@ -15,15 +15,6 @@
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
struct _WinTCGinaStripPrivate
{
GdkPixbuf* pixbuf_strip;
cairo_surface_t* surface_strip;
gboolean is_animating;
gint64 origin_time;
};
struct _WinTCGinaStripClass
{
GtkWidgetClass __parent__;
@@ -33,7 +24,13 @@ struct _WinTCGinaStrip
{
GtkWidget __parent__;
WinTCGinaStripPrivate* priv;
// UI resources and state
//
GdkPixbuf* pixbuf_strip;
cairo_surface_t* surface_strip;
gboolean is_animating;
gint64 origin_time;
};
//
@@ -79,11 +76,10 @@ static gboolean wintc_gina_strip_step(
//
// GTK TYPE DEFINITIONS & CTORS
//
G_DEFINE_TYPE_WITH_CODE(
G_DEFINE_TYPE(
WinTCGinaStrip,
wintc_gina_strip,
GTK_TYPE_WIDGET,
G_ADD_PRIVATE(WinTCGinaStrip)
GTK_TYPE_WIDGET
)
static void wintc_gina_strip_class_init(
@@ -111,15 +107,13 @@ static void wintc_gina_strip_init(
WinTCGinaStrip* self
)
{
self->priv = wintc_gina_strip_get_instance_private(self);
gtk_widget_set_has_window(GTK_WIDGET(self), FALSE);
// Load assets
//
GError* error = NULL;
self->priv->pixbuf_strip =
self->pixbuf_strip =
wintc_brand_get_brand_pixmap(
WINTC_BRAND_PART_STRIP_ANIM,
&error
@@ -127,9 +121,9 @@ static void wintc_gina_strip_init(
// FIXME: Handle error
self->priv->surface_strip =
self->surface_strip =
gdk_cairo_surface_create_from_pixbuf(
self->priv->pixbuf_strip,
self->pixbuf_strip,
1,
NULL // FIXME: Error reporting
);
@@ -144,8 +138,8 @@ static void wintc_gina_strip_finalize(
{
WinTCGinaStrip* strip = WINTC_GINA_STRIP(gobject);
cairo_surface_destroy(strip->priv->surface_strip);
g_clear_object(&(strip->priv->pixbuf_strip));
cairo_surface_destroy(strip->surface_strip);
g_clear_object(&(strip->pixbuf_strip));
(G_OBJECT_CLASS(wintc_gina_strip_parent_class))->finalize(gobject);
}
@@ -161,16 +155,16 @@ static gboolean wintc_gina_strip_draw(
// If animating, work out offset of strip based
// on time
//
if (strip->priv->is_animating)
if (strip->is_animating)
{
gint64 current_time = g_get_monotonic_time();
gint64 delta = strip->priv->origin_time - current_time;
gint64 delta = strip->origin_time - current_time;
gint64 mod_time = delta % ANIM_RATE_IN_US;
gdouble within_pct = (gdouble) mod_time / ANIM_RATE_IN_US;
gint img_width =
cairo_image_surface_get_width(
strip->priv->surface_strip
strip->surface_strip
);
x_offset = (gint) (img_width * within_pct);
@@ -180,7 +174,7 @@ static gboolean wintc_gina_strip_draw(
//
cairo_set_source_surface(
cr,
strip->priv->surface_strip,
strip->surface_strip,
x_offset,
0.0f
);
@@ -205,7 +199,7 @@ static void wintc_gina_strip_get_preferred_height(
height =
cairo_image_surface_get_height(
strip->priv->surface_strip
strip->surface_strip
);
*minimum_height = height;
@@ -237,7 +231,7 @@ static void wintc_gina_strip_get_preferred_width(
width =
cairo_image_surface_get_width(
strip->priv->surface_strip
strip->surface_strip
);
*minimum_width = width;
@@ -275,13 +269,13 @@ void wintc_gina_strip_animate(
WinTCGinaStrip* strip
)
{
if (strip->priv->is_animating)
if (strip->is_animating)
{
return;
}
strip->priv->is_animating = TRUE;
strip->priv->origin_time = g_get_monotonic_time();
strip->is_animating = TRUE;
strip->origin_time = g_get_monotonic_time();
gtk_widget_add_tick_callback(
GTK_WIDGET(strip),
@@ -295,7 +289,7 @@ void wintc_gina_strip_stop_animating(
WinTCGinaStrip* strip
)
{
strip->priv->is_animating = FALSE;
strip->is_animating = FALSE;
}
//
@@ -311,7 +305,7 @@ static gboolean wintc_gina_strip_step(
gtk_widget_queue_draw(widget);
return strip->priv->is_animating ?
return strip->is_animating ?
G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
}

View File

@@ -4,9 +4,8 @@
//
// GTK OOP BOILERPLATE
//
typedef struct _WinTCGinaStripPrivate WinTCGinaStripPrivate;
typedef struct _WinTCGinaStripClass WinTCGinaStripClass;
typedef struct _WinTCGinaStrip WinTCGinaStrip;
typedef struct _WinTCGinaStripClass WinTCGinaStripClass;
typedef struct _WinTCGinaStrip WinTCGinaStrip;
#define TYPE_WINTC_GINA_STRIP (wintc_gina_strip_get_type())
#define WINTC_GINA_STRIP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_GINA_STRIP, WinTCGinaStrip))

View File

@@ -30,7 +30,7 @@ wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
add_library(
libwintc-shelldpa
src/api.c
src/api.h
public/api.h
src/impl-wayland.c
src/impl-wayland.h
src/impl-wndmgmt-wnck.c
@@ -48,7 +48,6 @@ add_library(
set_target_properties(
libwintc-shelldpa
PROPERTIES
PUBLIC_HEADER public/wintc-shelldpa.h
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
@@ -89,9 +88,9 @@ target_link_libraries(
#
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
wintc_install_public_headers()
install(
TARGETS libwintc-shelldpa
LIBRARY DESTINATION ${LIB_DIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${LIB_DIR}
)

View File

@@ -0,0 +1,6 @@
#ifndef __WINTC_SHELLDPA_H__
#define __WINTC_SHELLDPA_H__
#include "shelldpa/api.h"
#endif

View File

@@ -0,0 +1,185 @@
/**
* @file
*
* This specifies the main API for the display protocol abstraction library.
*
* This library is subject to change massively, as the current iteration is
* much more akin to a 'polyfill'. It is a temporary solution between X11 and
* Wayland, until further testing and development is done to ensure proper
* support.
*
* The APIs provided here relate to things that involve talking over the
* display protocol for their functionality. Things such as window management
* and creating shell windows (eg. docked panels, the desktop).
*/
#ifndef __SHELLDPA_API_H__
#define __SHELLDPA_API_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
//
// PUBLIC DEFINES
//
/**
* Represents a screen/workspace for window management.
*/
#define WinTCWndMgmtScreen void
/**
* Represents a single window for window management.
*/
#define WinTCWndMgmtWindow void
//
// PUBLIC ENUMS
//
/**
* Specifies display protocols that are supported.
*/
typedef enum
{
/** The X11 display protocol. */
WINTC_DISPPROTO_X11,
/** The Wayland display protocol. */
WINTC_DISPPROTO_WAYLAND
} WinTCDisplayProtocol;
//
// PUBLIC FUNCTIONS
//
/**
* Creates a widget that can be used as a popup on the active display
* protocol.
*
* @param owner The widget to tie the popup to.
* @param enable_composition True if composition is needed (for shadows etc.)
* @return The appropriate widget cast to GtkWidget.
*/
GtkWidget* wintc_dpa_create_popup(
GtkWidget* owner,
gboolean enable_composition
);
/**
* Shows a popup.
*
* @param popup The popup.
* @param owner The widget to tie the popup to.
*/
void wintc_dpa_show_popup(
GtkWidget* popup,
GtkWidget* owner
);
/**
* Retrieves the active display protocol.
*
* @return The active display protocol.
*/
WinTCDisplayProtocol wintc_get_display_protocol_in_use(void);
/**
* Initializes the library functionality.
*
* @return True if initialization was successful.
*/
gboolean wintc_init_display_protocol_apis(void);
/**
* Anchors the window to the bottom of the primary display, assuming it is the
* taskband.
*
* @param taskband The taskband window.
*
* @remarks This function will be retired with a better, general purpose API.
*/
extern void (*wintc_anchor_taskband_to_bottom) (
GtkWindow* taskband
);
/**
* Assigns properties for the window to become the desktop.
*
* @param window The window.
*
* @remarks This function will be retired with a better, general purpose API.
*/
extern void (*wintc_become_desktop_window) (
GtkWindow* window
);
/**
* Retrieves the active window on the specified screen.
*
* @param screen The screen.
* @return The active window.
*/
extern WinTCWndMgmtWindow* (*wintc_wndmgmt_screen_get_active_window) (
WinTCWndMgmtScreen* screen
);
/**
* Retrieves the default screen.
*
* @return The default screen.
*/
extern WinTCWndMgmtScreen* (*wintc_wndmgmt_screen_get_default) (void);
/**
* Retrieves the icon for the specified window.
*
* @param window The window.
* @return A pixmap of the icon.
*/
extern GdkPixbuf* (*wintc_wndmgmt_window_get_mini_icon) (
WinTCWndMgmtWindow* window
);
/**
* Retrieves the title of the specified window.
*
* @param window The window.
* @return The window title.
*/
extern gchar* (*wintc_wndmgmt_window_get_name) (
WinTCWndMgmtWindow* window
);
/**
* Determines whether the specified window should receive a button in the
* window switcher.
*
* @param window The window.
* @return True if the window should have a button in the window switcher.
*/
extern gboolean (*wintc_wndmgmt_window_is_skip_tasklist) (
WinTCWndMgmtWindow* window
);
/**
* Minimizes the specified window.
*
* @param window The window.
*/
extern void (*wintc_wndmgmt_window_minimize) (
WinTCWndMgmtWindow* window
);
/**
* Unminimizes the specified window.
*
* @param window The window.
* @param timestamp The timestamp, for focus stealing prevention.
*/
extern void (*wintc_wndmgmt_window_unminimize) (
WinTCWndMgmtWindow* window,
guint64 timestamp
);
#endif

View File

@@ -1,64 +0,0 @@
#ifndef __WINTC_SHELLDPA_H__
#define __WINTC_SHELLDPA_H__
//
// PUBLIC DEFINES
//
#define WinTCWndMgmtScreen void
#define WinTCWndMgmtWindow void
//
// PUBLIC ENUMS
//
typedef enum
{
WINTC_DISPPROTO_X11,
WINTC_DISPPROTO_WAYLAND
} WinTCDisplayProtocol;
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_dpa_create_popup(
GtkWidget* owner,
gboolean enable_composition
);
void wintc_dpa_show_popup(
GtkWidget* popup,
GtkWidget* owner
);
WinTCDisplayProtocol wintc_get_display_protocol_in_use(void);
gboolean wintc_init_display_protocol_apis(void);
extern void (*wintc_anchor_taskband_to_bottom) (
GtkWindow* taskband
);
extern void (*wintc_become_desktop_window) (
GtkWindow* window
);
extern WinTCWndMgmtWindow* (*wintc_wndmgmt_screen_get_active_window) (
WinTCWndMgmtScreen* screen
);
extern WinTCWndMgmtScreen* (*wintc_wndmgmt_screen_get_default) (void);
extern GdkPixbuf* (*wintc_wndmgmt_window_get_mini_icon) (
WinTCWndMgmtWindow* window
);
extern gchar* (*wintc_wndmgmt_window_get_name) (
WinTCWndMgmtWindow* window
);
extern gboolean (*wintc_wndmgmt_window_is_skip_tasklist) (
WinTCWndMgmtWindow* window
);
extern void (*wintc_wndmgmt_window_minimize) (
WinTCWndMgmtWindow* window
);
extern void (*wintc_wndmgmt_window_unminimize) (
WinTCWndMgmtWindow* window,
guint64 timestamp
);
#endif

View File

@@ -2,9 +2,9 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "api.h"
#include "../public/api.h"
#include "impl-wayland.h"
#include "impl-x11.h"
#include "impl-wndmgmt-wnck.h"

View File

@@ -1,68 +0,0 @@
#ifndef __API_H__
#define __API_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <gtk/gtk.h>
//
// PUBLIC DEFINES
//
#define WinTCWndMgmtScreen void
#define WinTCWndMgmtWindow void
//
// PUBLIC ENUMS
//
typedef enum
{
WINTC_DISPPROTO_X11,
WINTC_DISPPROTO_WAYLAND
} WinTCDisplayProtocol;
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_dpa_create_popup(
GtkWidget* owner,
gboolean enable_composition
);
void wintc_dpa_show_popup(
GtkWidget* popup,
GtkWidget* owner
);
WinTCDisplayProtocol wintc_get_display_protocol_in_use(void);
gboolean wintc_init_display_protocol_apis(void);
extern void (*wintc_anchor_taskband_to_bottom) (
GtkWindow* taskband
);
extern void (*wintc_become_desktop_window) (
GtkWindow* window
);
extern WinTCWndMgmtWindow* (*wintc_wndmgmt_screen_get_active_window) (
WinTCWndMgmtScreen* screen
);
extern WinTCWndMgmtScreen* (*wintc_wndmgmt_screen_get_default) (void);
extern GdkPixbuf* (*wintc_wndmgmt_window_get_mini_icon) (
WinTCWndMgmtWindow* window
);
extern gchar* (*wintc_wndmgmt_window_get_name) (
WinTCWndMgmtWindow* window
);
extern gboolean (*wintc_wndmgmt_window_is_skip_tasklist) (
WinTCWndMgmtWindow* window
);
extern void (*wintc_wndmgmt_window_minimize) (
WinTCWndMgmtWindow* window
);
extern void (*wintc_wndmgmt_window_unminimize) (
WinTCWndMgmtWindow* window,
guint64 timestamp
);
#endif

View File

@@ -1,10 +1,10 @@
#include <dlfcn.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "../../public/api.h"
#include "wnck.h"
#include "../api.h"
//
// STATIC DATA

View File

@@ -4,7 +4,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include "../api.h"
#include "../../public/api.h"
//
// PUBLIC ENUMS

View File

@@ -1,10 +1,10 @@
#include <dlfcn.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "../../public/api.h"
#include "xfw.h"
#include "../api.h"
//
// STATIC DATA

View File

@@ -4,7 +4,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include "../api.h"
#include "../../public/api.h"
//
// RESOLVED FUNCS

View File

@@ -3,7 +3,7 @@
#include <glib.h>
#include <gtk/gtk.h>
#include "api.h"
#include "../public/api.h"
#include "impl-wayland.h"
//

View File

@@ -1,9 +1,9 @@
#include <dlfcn.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "api.h"
#include "../public/api.h"
#include "impl-wndmgmt-wnck.h"
#include "dll/wnck.h"

View File

@@ -1,9 +1,9 @@
#include <dlfcn.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "api.h"
#include "../public/api.h"
#include "impl-wndmgmt-xfw.h"
#include "dll/xfw.h"

View File

@@ -1,9 +1,9 @@
#include <gdk/gdk.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc-comgtk.h>
#include <wintc/comgtk.h>
#include "api.h"
#include "../public/api.h"
#include "impl-x11.h"
//

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.5)
project(
libwintc-shllang
libwintc-shlang
VERSION 1.0
DESCRIPTION "Windows Total Conversion shell language string utilities."
LANGUAGES C
@@ -25,39 +25,37 @@ wintc_resolve_library(glib-2.0 GLIB)
wintc_resolve_library(gtk+-3.0 GTK3)
wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
configure_file(public/wintc-shllang.h.in ${PROJECT_ROOT}/public/wintc-shllang.h @ONLY)
configure_file(src/domain.h.in ${PROJECT_ROOT}/src/domain.h @ONLY)
configure_file(public/domain.h.in ${PROJECT_ROOT}/public/domain.h @ONLY)
wintc_create_config_h()
add_library(
libwintc-shllang
libwintc-shlang
src/config.h
src/domain.h
public/domain.h
src/controls.c
src/controls.h
public/controls.h
src/places.c
src/places.h
src/punctuation.h
public/places.h
public/punctuation.h
src/ui.c
src/ui.h
public/ui.h
)
set_target_properties(
libwintc-shllang
libwintc-shlang
PROPERTIES
PUBLIC_HEADER public/wintc-shllang.h
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
target_compile_options(
libwintc-shllang
libwintc-shlang
PRIVATE ${WINTC_COMPILE_OPTIONS}
)
target_include_directories(
libwintc-shllang
libwintc-shlang
SYSTEM
BEFORE
PRIVATE ${GLIB_INCLUDE_DIRS}
@@ -66,14 +64,14 @@ target_include_directories(
)
target_link_directories(
libwintc-shllang
libwintc-shlang
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
)
target_link_libraries(
libwintc-shllang
libwintc-shlang
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMGTK_LIBRARIES}
@@ -84,9 +82,9 @@ target_link_libraries(
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
wintc_compile_and_install_pofiles()
wintc_install_public_headers()
install(
TARGETS libwintc-shllang
LIBRARY DESTINATION ${LIB_DIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
TARGETS libwintc-shlang
LIBRARY DESTINATION ${LIB_DIR}
)

View File

@@ -1,4 +1,4 @@
# libwintc-shllang
# libwintc-shlang
This directory contains the source code for the common shell language strings library.
## Purpose

Some files were not shown because too many files have changed in this diff Show More