wip: initial main window design

This commit is contained in:
Gergely Polonkai 2019-01-11 16:09:58 +01:00
parent 2819efdf80
commit 505573ee03
7 changed files with 458 additions and 9 deletions

View File

@ -2,5 +2,6 @@
<gresources> <gresources>
<gresource prefix="/eu/polonkai/gergely/SsbGtk"> <gresource prefix="/eu/polonkai/gergely/SsbGtk">
<file>ui/ssb-window.ui</file> <file>ui/ssb-window.ui</file>
<file>ui/ssb-profile.ui</file>
</gresource> </gresource>
</gresources> </gresources>

View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="SsbProfile" parent="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="profile-picture-image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="height">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="profile-name-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="profile-id-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="profile-edit-button">
<property name="label" translatable="yes">Edit Profile</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="profile-details">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="profile-names-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="profile-pictures-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Send Private Message</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Friends</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="profile-friends-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Followers</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="profile-followers-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Following</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="profile-followings-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
<property name="height">6</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="profile-messages">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">3</property>
</packing>
</child>
</template>
</interface>

View File

@ -8,18 +8,89 @@
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="title" translatable="yes">Secure Scuttlebutt</property>
<property name="show_close_button">True</property> <property name="show_close_button">True</property>
<child type="title">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkStackSwitcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stack">stack1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="search-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-find-symbolic</property>
</object> </object>
</child> </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="stack1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child> <child>
<object class="GtkGrid"> <object class="GtkGrid">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<child> <child>
<object class="GtkListBox"> <object class="GtkButton" id="join-pub-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Join Pub</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@ -27,15 +98,149 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkListBox"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Active Channels</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="active-channel-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Connected Pubs</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="connected-pubs-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Who to Follow</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="who-to-follow-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="new-message-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="accepts_tab">False</property>
<property name="input_hints">GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_EMOJI | GTK_INPUT_HINT_NONE</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkListBox" id="public-messages-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="height">6</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Public</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkListBox" id="private-messages-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="private-senders-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="title" translatable="yes">Private</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="SsbProfile">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="title" translatable="yes">Profile</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="mentions-list">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="title" translatable="yes">Mentions</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
</child> </child>
</template> </template>

View File

@ -2,6 +2,7 @@ sources = [
'main.c', 'main.c',
'ssb-app.c', 'ssb-app.c',
'ssb-window.c', 'ssb-window.c',
'ssb-profile.c',
'sbot.c', 'sbot.c',
] ]

29
ssb-gtk/ssb-profile.c Normal file
View File

@ -0,0 +1,29 @@
#include "ssb-profile.h"
struct _SsbProfile {
GtkGrid parent_instance;
};
G_DEFINE_TYPE(SsbProfile, ssb_profile, GTK_TYPE_GRID);
SsbProfile *
ssb_profile_new(void)
{
SsbProfile *profile = g_object_new(SSB_TYPE_PROFILE, NULL);
return profile;
}
static void
ssb_profile_init(SsbProfile *profile)
{
gtk_widget_init_template(GTK_WIDGET(profile));
}
static void
ssb_profile_class_init(SsbProfileClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
gtk_widget_class_set_template_from_resource(widget_class, "/eu/polonkai/gergely/SsbGtk/ui/ssb-profile.ui");
}

16
ssb-gtk/ssb-profile.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef __SSB_PROFILE_H__
# define __SSB_PROFILE_H__
# include <glib-object.h>
# include <gtk/gtk.h>
# define SSB_TYPE_PROFILE ssb_profile_get_type()
G_DECLARE_FINAL_TYPE(SsbProfile, ssb_profile, SSB, PROFILE, GtkGrid)
G_BEGIN_DECLS
SsbProfile *ssb_profile_new();
G_END_DECLS
#endif /* __SSB_PROFILE_H__ */

View File

@ -1,4 +1,5 @@
#include "ssb-window.h"\ #include "ssb-window.h"
#include "ssb-profile.h"
struct _SsbWindow { struct _SsbWindow {
GtkApplicationWindow parent_instance; GtkApplicationWindow parent_instance;
@ -20,6 +21,8 @@ ssb_window_new(SsbApp *app)
static void static void
ssb_window_init(SsbWindow *window) ssb_window_init(SsbWindow *window)
{ {
g_type_ensure(SSB_TYPE_PROFILE);
gtk_widget_init_template(GTK_WIDGET(window)); gtk_widget_init_template(GTK_WIDGET(window));
} }