mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-05-01 19:51:33 +00:00
Enhancement: Fixes #131, Implement dialog button box widget in comctl lib - use in run and winver
This commit is contained in:
@@ -23,6 +23,7 @@ include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
wintc_resolve_library(gdk-3.0 GDK)
|
||||
wintc_resolve_library(glib-2.0 GLIB)
|
||||
wintc_resolve_library(gtk+-3.0 GTK3)
|
||||
wintc_resolve_library(wintc-comctl WINTC_COMCTL)
|
||||
wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
|
||||
wintc_resolve_library(wintc-exec WINTC_EXEC)
|
||||
wintc_resolve_library(wintc-shllang WINTC_SHLLANG)
|
||||
@@ -58,6 +59,7 @@ target_include_directories(
|
||||
PRIVATE ${GDK_INCLUDE_DIRS}
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMCTL_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_EXEC_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_SHLLANG_INCLUDE_DIRS}
|
||||
@@ -68,6 +70,7 @@ target_link_directories(
|
||||
PRIVATE ${GDK_LIBRARY_DIRS}
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMCTL_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_EXEC_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_SHLLANG_LIBRARY_DIRS}
|
||||
@@ -78,6 +81,7 @@ target_link_libraries(
|
||||
PRIVATE ${GDK_LIBRARIES}
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMCTL_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARIES}
|
||||
PRIVATE ${WINTC_EXEC_LIBRARIES}
|
||||
PRIVATE ${WINTC_SHLLANG_LIBRARIES}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# run
|
||||
This directory contains the source code for the *Run* application.
|
||||
|
||||

|
||||

|
||||
|
||||
## Keyboard Shortcut
|
||||
You can add `run` to a keyboard shortcut on `Win`+`R`/`super`+`R` as follows:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
bt,rt:glib2
|
||||
bt,rt:gtk3
|
||||
bt,rt:wintc-comctl
|
||||
bt,rt:wintc-comgtk
|
||||
bt,rt:wintc-exec
|
||||
bt,rt:wintc-shllang
|
||||
|
||||
BIN
shell/run/preview.png
Normal file
BIN
shell/run/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -1,6 +1,7 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comctl.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "application.h"
|
||||
@@ -28,25 +29,6 @@ static void wintc_run_application_activate(
|
||||
GApplication* application
|
||||
);
|
||||
|
||||
static void wintc_run_application_finalize(
|
||||
GObject* object
|
||||
);
|
||||
|
||||
static void wintc_run_application_open(
|
||||
GApplication* application,
|
||||
GFile** files,
|
||||
int n_files,
|
||||
const gchar* hint
|
||||
);
|
||||
|
||||
static void wintc_run_application_startup(
|
||||
GApplication* application
|
||||
);
|
||||
|
||||
static void wintc_run_application_shutdown(
|
||||
GApplication* application
|
||||
);
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
@@ -57,30 +39,14 @@ static void wintc_run_application_class_init(
|
||||
)
|
||||
{
|
||||
GApplicationClass* application_class = G_APPLICATION_CLASS(klass);
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||
|
||||
application_class->activate = wintc_run_application_activate;
|
||||
application_class->open = wintc_run_application_open;
|
||||
application_class->startup = wintc_run_application_startup;
|
||||
application_class->shutdown = wintc_run_application_shutdown;
|
||||
|
||||
object_class->finalize = wintc_run_application_finalize;
|
||||
}
|
||||
|
||||
static void wintc_run_application_init(
|
||||
WINTC_UNUSED(WinTCRunApplication* self)
|
||||
) {}
|
||||
|
||||
//
|
||||
// FINALIZE
|
||||
//
|
||||
static void wintc_run_application_finalize(
|
||||
GObject* object
|
||||
)
|
||||
{
|
||||
(*G_OBJECT_CLASS(wintc_run_application_parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
@@ -109,32 +75,14 @@ static void wintc_run_application_activate(
|
||||
{
|
||||
WinTCRunApplication* run_app = WINTC_RUN_APPLICATION(application);
|
||||
|
||||
wintc_comctl_install_default_styles();
|
||||
|
||||
if (run_app->main_window == NULL)
|
||||
{
|
||||
run_app->main_window = wintc_run_dialog_new(run_app);
|
||||
|
||||
gtk_widget_show_all(run_app->main_window);
|
||||
}
|
||||
|
||||
wintc_focus_window(GTK_WINDOW(run_app->main_window));
|
||||
}
|
||||
|
||||
static void wintc_run_application_open(
|
||||
WINTC_UNUSED(GApplication* application),
|
||||
WINTC_UNUSED(GFile** files),
|
||||
WINTC_UNUSED(int n_files),
|
||||
WINTC_UNUSED(const gchar* hint)
|
||||
) {}
|
||||
|
||||
static void wintc_run_application_startup(
|
||||
GApplication* application
|
||||
)
|
||||
{
|
||||
WinTCRunApplication* run_app = WINTC_RUN_APPLICATION(application);
|
||||
|
||||
(G_APPLICATION_CLASS(wintc_run_application_parent_class))->startup(application);
|
||||
|
||||
run_app->main_window = wintc_run_dialog_new(run_app);
|
||||
|
||||
gtk_widget_show_all(run_app->main_window);
|
||||
}
|
||||
|
||||
static void wintc_run_application_shutdown(
|
||||
GApplication* application
|
||||
)
|
||||
{
|
||||
(G_APPLICATION_CLASS(wintc_run_application_parent_class))->shutdown(application);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comctl.h>
|
||||
#include <wintc-comgtk.h>
|
||||
#include <wintc-exec.h>
|
||||
#include <wintc-shllang.h>
|
||||
@@ -217,6 +218,11 @@ static void wintc_run_dialog_init(
|
||||
gtk_box_pack_end(GTK_BOX(box_buttons), button_ok, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(box_outer), box_buttons, FALSE, FALSE, 0);
|
||||
|
||||
wintc_widget_add_style_class(
|
||||
box_buttons,
|
||||
WINTC_COMCTL_BUTTON_BOX_CLASS
|
||||
);
|
||||
|
||||
// Set OK button as default widget
|
||||
//
|
||||
gtk_window_set_default(GTK_WINDOW(self), button_ok);
|
||||
@@ -225,6 +231,7 @@ static void wintc_run_dialog_init(
|
||||
//
|
||||
// FIXME: This should not be done here, use screen CSS instead!
|
||||
//
|
||||
wintc_widget_add_css(box_buttons, "box { margin: 0px; }");
|
||||
wintc_widget_add_css(box_outer, "box { margin: 18px 11px 0px; }");
|
||||
wintc_widget_add_css(box_instructions, "box { margin-bottom: 13px; }");
|
||||
wintc_widget_add_css(box_input, "box { margin-bottom: 34px; }");
|
||||
|
||||
@@ -22,6 +22,7 @@ include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
wintc_resolve_library(gdk-pixbuf-2.0 GDK_PIXBUF)
|
||||
wintc_resolve_library(glib-2.0 GLIB)
|
||||
wintc_resolve_library(gtk+-3.0 GTK3)
|
||||
wintc_resolve_library(wintc-comctl WINTC_COMCTL)
|
||||
wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
|
||||
wintc_resolve_library(wintc-winbrand WINTC_WINBRAND)
|
||||
|
||||
@@ -47,6 +48,7 @@ target_include_directories(
|
||||
PRIVATE ${GDK_PIXBUF_INCLUDE_DIRS}
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMCTL_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_WINBRAND_INCLUDE_DIRS}
|
||||
)
|
||||
@@ -56,6 +58,7 @@ target_link_directories(
|
||||
PRIVATE ${GDK_PIXBUF_LIBRARY_DIRS}
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMCTL_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_WINBRAND_LIBRARY_DIRS}
|
||||
)
|
||||
@@ -65,6 +68,7 @@ target_link_libraries(
|
||||
PRIVATE ${GDK_PIXBUF_LIBRARIES}
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMCTL_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARIES}
|
||||
PRIVATE ${WINTC_WINBRAND_LIBRARIES}
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
bt,rt:gdk-pixbuf2
|
||||
bt,rt:glib2
|
||||
bt,rt:gtk3
|
||||
bt,rt:wintc-comctl
|
||||
bt,rt:wintc-comgtk
|
||||
bt,rt:wintc-winbrand
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <wintc-comctl.h>
|
||||
#include <wintc-comgtk.h>
|
||||
#include <wintc-winbrand.h>
|
||||
|
||||
@@ -60,6 +61,8 @@ int main(
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
wintc_comctl_install_default_styles();
|
||||
|
||||
// Create the window
|
||||
//
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
@@ -160,11 +163,6 @@ int main(
|
||||
//
|
||||
button_ok = gtk_button_new_with_label("OK");
|
||||
|
||||
apply_box_model_style(button_ok, "margin", "right", 8);
|
||||
apply_box_model_style(button_ok, "margin", "bottom", 10);
|
||||
apply_box_model_style(button_ok, "padding", "left", 26);
|
||||
apply_box_model_style(button_ok, "padding", "right", 26);
|
||||
|
||||
g_signal_connect(
|
||||
button_ok,
|
||||
"clicked",
|
||||
@@ -191,6 +189,11 @@ int main(
|
||||
|
||||
gtk_box_pack_end(GTK_BOX(box), box_buttons, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end(GTK_BOX(box_buttons), button_ok, FALSE, FALSE, 0);
|
||||
|
||||
wintc_widget_add_style_class(
|
||||
box_buttons,
|
||||
WINTC_COMCTL_BUTTON_BOX_CLASS
|
||||
);
|
||||
|
||||
// Clear mem
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user