Update gtk148
This commit is contained in:
parent
dc6e0671ac
commit
8970b3c274
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||||
|
<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd">
|
||||||
|
<cambalache-project version="0.11.2" target_tk="gtk-4.0">
|
||||||
|
<ui>
|
||||||
|
(1,None,"window.ui","window.ui",None,None,None,None,None,None,None)
|
||||||
|
</ui>
|
||||||
|
<object>
|
||||||
|
(1,1,"GtkWindow",None,None,None,None,None,None,None),
|
||||||
|
(1,2,"GtkDirectoryList",None,1,None,None,None,None,None)
|
||||||
|
</object>
|
||||||
|
</cambalache-project>
|
|
@ -26,7 +26,7 @@ link_directories (${GTKMM4_LIBRARY_DIRS})
|
||||||
# set(PO_DIR ${CMAKE_BINARY_DIR}/po/zh_CN/LC_MESSAGES)
|
# set(PO_DIR ${CMAKE_BINARY_DIR}/po/zh_CN/LC_MESSAGES)
|
||||||
|
|
||||||
#Source files
|
#Source files
|
||||||
set(SOURCE_FILE src/main.cpp src/MainWin.cpp)
|
set(SOURCE_FILE src/main.cpp src/MainWin.cpp src/MyItem.cpp)
|
||||||
|
|
||||||
#Compile Resource
|
#Compile Resource
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,66 @@
|
||||||
#include "MainWin.hh"
|
#include "MainWin.h"
|
||||||
|
#include "MyItem.h"
|
||||||
|
|
||||||
struct _MainWin{
|
struct _MainWin{
|
||||||
GtkApplicationWindow parent_instance;
|
GtkApplicationWindow parent_instance;
|
||||||
GListModel *model;
|
GListModel *model;
|
||||||
GtkListView *view;
|
GtkWidget *view;
|
||||||
|
GtkListItemFactory *factory;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE(MainWin, main_win, GTK_TYPE_APPLICATION_WINDOW)
|
G_DEFINE_TYPE(MainWin, main_win, GTK_TYPE_APPLICATION_WINDOW)
|
||||||
|
|
||||||
|
static void setup_list_item(GtkListItemFactory *factory, GtkListItem *item){
|
||||||
|
// Create label to show list item
|
||||||
|
GtkWidget *label;
|
||||||
|
label = gtk_label_new(" ");
|
||||||
|
gtk_list_item_set_child(item, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bind_list_item(GtkListItemFactory *factory, GtkListItem *item){
|
||||||
|
// Get child for list item
|
||||||
|
GtkWidget *label;
|
||||||
|
label = gtk_list_item_get_child(item);
|
||||||
|
|
||||||
|
// Get string
|
||||||
|
MyItem *item1 = (MyItem*)gtk_list_item_get_item(item);
|
||||||
|
GString *string = my_item_get_string(item1);
|
||||||
|
gtk_label_set_label(GTK_LABEL(label), string->str);
|
||||||
|
// g_string_free(string, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static GListModel *create_list_model()
|
static GListModel *create_list_model()
|
||||||
{
|
{
|
||||||
GListStore *store;
|
GListStore *store;
|
||||||
|
|
||||||
// Create the list store
|
// Create the list store
|
||||||
store = g_list_store_new(G_TYPE_STRING);
|
store = g_list_store_new(my_item_get_type());
|
||||||
|
|
||||||
// Fill the store
|
// Fill the store
|
||||||
g_list_store_append(store, g_string_new("Item 1"));
|
g_list_store_append(store, my_item_new("Item 1"));
|
||||||
g_list_store_append(store, g_string_new("Item 2"));
|
g_list_store_append(store, my_item_new("Item 2"));
|
||||||
g_list_store_append(store, g_string_new("Item 3"));
|
g_list_store_append(store, my_item_new("Item 3"));
|
||||||
|
|
||||||
return G_LIST_MODEL(store);
|
return G_LIST_MODEL(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void main_win_init(MainWin *self){
|
static void main_win_init(MainWin *self){
|
||||||
|
// Initalize window
|
||||||
|
gtk_window_set_icon_name(GTK_WINDOW(self), "org.gtk.daleclack");
|
||||||
|
gtk_window_set_default_size(GTK_WINDOW(self), 640, 360);
|
||||||
|
|
||||||
// Create list model
|
// Create list model
|
||||||
GListModel *model = create_list_model();
|
self->model = create_list_model();
|
||||||
|
|
||||||
// Create Factory
|
// Create Factory
|
||||||
|
self->factory = gtk_signal_list_item_factory_new();
|
||||||
|
g_signal_connect(self->factory, "setup", G_CALLBACK(setup_list_item), NULL);
|
||||||
|
g_signal_connect(self->factory, "bind", G_CALLBACK(bind_list_item), NULL);
|
||||||
|
|
||||||
|
// Create view
|
||||||
|
self->view = gtk_list_view_new(GTK_SELECTION_MODEL(gtk_single_selection_new(self->model)),
|
||||||
|
self->factory);
|
||||||
|
gtk_window_set_child(GTK_WINDOW(self), self->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void main_win_class_init(MainWinClass *klass){
|
static void main_win_class_init(MainWinClass *klass){
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#include "MyItem.h"
|
||||||
|
|
||||||
|
struct _MyItem{
|
||||||
|
GObject parent_instance;
|
||||||
|
GString *string;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(MyItem, my_item, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
static void my_item_dispose(GObject *object){
|
||||||
|
// Free the memory
|
||||||
|
g_string_free(MY_ITEM(object)->string, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_item_init(MyItem *self){
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_item_class_init(MyItemClass *klass){
|
||||||
|
G_OBJECT_CLASS(klass)->dispose = my_item_dispose;
|
||||||
|
}
|
||||||
|
|
||||||
|
GString *my_item_get_string(MyItem *self){
|
||||||
|
return self->string;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyItem *my_item_new(const char *str){
|
||||||
|
// Create a new MyItem and initalize
|
||||||
|
MyItem *item = MY_ITEM(g_object_new(my_item_get_type(), NULL));
|
||||||
|
item->string = g_string_new(str);
|
||||||
|
return item;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE(MyItem, my_item, MY, ITEM, GObject)
|
||||||
|
|
||||||
|
MyItem *my_item_new(const char *str);
|
||||||
|
|
||||||
|
GString *my_item_get_string(MyItem *self);
|
|
@ -1,4 +1,4 @@
|
||||||
#include "MainWin.hh"
|
#include "MainWin.h"
|
||||||
|
|
||||||
static void gtkmain(GtkApplication *app, gpointer data){
|
static void gtkmain(GtkApplication *app, gpointer data){
|
||||||
MainWin *window = main_win_new(app);
|
MainWin *window = main_win_new(app);
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientExtensions-Package~31bf3856ad364e35~amd64~en-US~10.0.22621.1.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientExtensions-Package~31bf3856ad364e35~amd64~zh-CN~10.0.22621.1.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientExtensions-Package~31bf3856ad364e35~amd64~~10.0.22621.1465.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientExtensions-Package~31bf3856ad364e35~amd64~~10.0.22621.891.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientTools-Package~31bf3856ad364e35~amd64~en-US~10.0.22621.1325.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientTools-Package~31bf3856ad364e35~amd64~en-US~10.0.22621.1391.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientTools-Package~31bf3856ad364e35~amd64~zh-CN~10.0.22621.1325.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientTools-Package~31bf3856ad364e35~amd64~zh-CN~10.0.22621.1391.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientTools-Package~31bf3856ad364e35~amd64~~10.0.22621.1325.mum
|
||||||
|
Microsoft-Windows-GroupPolicy-ClientTools-Package~31bf3856ad364e35~amd64~~10.0.22621.1465.mum
|
|
@ -0,0 +1,11 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
pushd "%~dp0"
|
||||||
|
|
||||||
|
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt
|
||||||
|
|
||||||
|
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt
|
||||||
|
|
||||||
|
for /f %%i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"C:\Windows\servicing\Packages\%%i"
|
||||||
|
|
||||||
|
pause
|
Loading…
Reference in New Issue