[gnome-builder/wip/chergert/dspy: 11/11] wip on design
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/dspy: 11/11] wip on design
- Date: Sun, 14 Apr 2019 20:35:48 +0000 (UTC)
commit 2f77d924e0a73da75e38d50e199da5976654a7fb
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 13 13:50:04 2019 -0700
wip on design
src/plugins/dspy/dspy-name-view.c | 40 +++++++++++++++++++++++++--
src/plugins/dspy/dspy-name-view.ui | 15 ++++++++++
src/plugins/dspy/gbp-dspy-private.h | 30 ++++++++++++++++++++
src/plugins/dspy/gbp-dspy-surface.c | 13 +++++++++
src/plugins/dspy/gbp-dspy-surface.ui | 34 +++++++++++++++++------
src/plugins/dspy/gbp-dspy-workspace.c | 12 ++++++--
src/plugins/dspy/gbp-dspy-workspace.ui | 50 +++++++++++++++++++++++++++++++++-
7 files changed, 181 insertions(+), 13 deletions(-)
---
diff --git a/src/plugins/dspy/dspy-name-view.c b/src/plugins/dspy/dspy-name-view.c
index e71d45c22..cb786e1df 100644
--- a/src/plugins/dspy/dspy-name-view.c
+++ b/src/plugins/dspy/dspy-name-view.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <dazzle.h>
+#include <glib/gi18n.h>
#include "dspy-name-view.h"
#include "dspy-path-model.h"
@@ -45,12 +46,12 @@ G_DEFINE_TYPE (DspyNameView, dspy_name_view, GTK_TYPE_BIN)
static void
on_refresh_button_clicked_cb (DspyNameView *self,
- GtkButton *button)
+ GtkWidget *button)
{
g_autoptr(DspyPathModel) path_model = NULL;
g_assert (DSPY_IS_NAME_VIEW (self));
- g_assert (GTK_IS_BUTTON (button));
+ g_assert (GTK_IS_BUTTON (button) || GTK_IS_TREE_VIEW_COLUMN (button));
if (self->name == NULL)
return;
@@ -151,6 +152,41 @@ dspy_name_view_init (DspyNameView *self)
G_CALLBACK (on_tree_view_row_activated_cb),
self,
G_CONNECT_SWAPPED);
+
+ {
+ GtkWidget *box;
+ GtkWidget *button;
+ GtkWidget *label;
+
+ box = g_object_new (GTK_TYPE_BOX,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "visible", TRUE,
+ NULL);
+ label = g_object_new (GTK_TYPE_LABEL,
+ "label", _("Object Path"),
+ "hexpand", TRUE,
+ "visible", TRUE,
+ NULL);
+ button = g_object_new (GTK_TYPE_BUTTON,
+ "visible", TRUE,
+ "child", g_object_new (GTK_TYPE_IMAGE,
+ "icon-name", "view-refresh-symbolic",
+ "pixel-size", 16,
+ "visible", TRUE,
+ NULL),
+ NULL);
+ g_signal_connect_object (gtk_tree_view_get_column (self->tree_view, 0),
+ "clicked",
+ G_CALLBACK (on_refresh_button_clicked_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
+ gtk_container_add (GTK_CONTAINER (box), label);
+ gtk_container_add (GTK_CONTAINER (box), button);
+
+ gtk_tree_view_column_set_widget (gtk_tree_view_get_column (self->tree_view, 0), box);
+ gtk_tree_view_set_headers_clickable (self->tree_view, TRUE);
+ }
}
DspyNameView *
diff --git a/src/plugins/dspy/dspy-name-view.ui b/src/plugins/dspy/dspy-name-view.ui
index e1558a821..963ba0d3a 100644
--- a/src/plugins/dspy/dspy-name-view.ui
+++ b/src/plugins/dspy/dspy-name-view.ui
@@ -110,6 +110,18 @@
</packing>
</child>
</object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="orientation">horizontal</property>
+ <property name="visible">true</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
<child>
<object class="GtkScrolledWindow">
@@ -139,6 +151,9 @@
</object>
</child>
</object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
</child>
diff --git a/src/plugins/dspy/gbp-dspy-private.h b/src/plugins/dspy/gbp-dspy-private.h
new file mode 100644
index 000000000..3500b5cb1
--- /dev/null
+++ b/src/plugins/dspy/gbp-dspy-private.h
@@ -0,0 +1,30 @@
+/* gbp-dspy-private.h
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include "gbp-dspy-surface.h"
+
+G_BEGIN_DECLS
+
+void _gbp_dspy_surface_set_size_group (GbpDspySurface *surface,
+ GtkSizeGroup *group);
+
+G_END_DECLS
diff --git a/src/plugins/dspy/gbp-dspy-surface.c b/src/plugins/dspy/gbp-dspy-surface.c
index c414a7f97..418ec10db 100644
--- a/src/plugins/dspy/gbp-dspy-surface.c
+++ b/src/plugins/dspy/gbp-dspy-surface.c
@@ -30,6 +30,7 @@
#include "dspy-name-row.h"
#include "dspy-name-view.h"
+#include "gbp-dspy-private.h"
#include "gbp-dspy-surface.h"
struct _GbpDspySurface
@@ -41,6 +42,7 @@ struct _GbpDspySurface
GtkStack *view_stack;
DspyNameView *name_view;
GtkBox *bus_box;
+ GtkBox *left_box;
DspyConnectionModel *model;
};
@@ -196,6 +198,7 @@ gbp_dspy_surface_class_init (GbpDspySurfaceClass *klass)
gtk_widget_class_bind_template_child (widget_class, GbpDspySurface, names_list_box);
gtk_widget_class_bind_template_child (widget_class, GbpDspySurface, names_scroller);
gtk_widget_class_bind_template_child (widget_class, GbpDspySurface, name_view);
+ gtk_widget_class_bind_template_child (widget_class, GbpDspySurface, left_box);
gtk_widget_class_bind_template_child (widget_class, GbpDspySurface, view_stack);
g_type_ensure (DSPY_TYPE_NAME_VIEW);
@@ -225,3 +228,13 @@ gbp_dspy_surface_new (void)
{
return g_object_new (GBP_TYPE_DSPY_SURFACE, NULL);
}
+
+void
+_gbp_dspy_surface_set_size_group (GbpDspySurface *self,
+ GtkSizeGroup *group)
+{
+ g_return_if_fail (GBP_IS_DSPY_SURFACE (self));
+ g_return_if_fail (GTK_IS_SIZE_GROUP (group));
+
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->left_box));
+}
diff --git a/src/plugins/dspy/gbp-dspy-surface.ui b/src/plugins/dspy/gbp-dspy-surface.ui
index 15a1dc6e7..968dc6f70 100644
--- a/src/plugins/dspy/gbp-dspy-surface.ui
+++ b/src/plugins/dspy/gbp-dspy-surface.ui
@@ -2,9 +2,8 @@
<interface>
<template class="GbpDspySurface" parent="IdeSurface">
<child>
- <object class="GtkPaned" id="paned">
+ <object class="DzlMultiPaned" id="paned">
<property name="orientation">horizontal</property>
- <property name="position">300</property>
<property name="visible">true</property>
<child>
<object class="GtkBox">
@@ -26,14 +25,33 @@
</object>
</child>
<child>
- <object class="GtkScrolledWindow" id="names_scroller">
- <property name="propagate-natural-height">true</property>
- <property name="propagate-natural-width">true</property>
+ <object class="GtkBox" id="left_box">
+ <property name="orientation">vertical</property>
<property name="visible">true</property>
- <property name="vexpand">true</property>
<child>
- <object class="GtkListBox" id="names_list_box">
- <property name="selection-mode">browse</property>
+ <object class="GtkScrolledWindow" id="names_scroller">
+ <property name="propagate-natural-height">true</property>
+ <property name="propagate-natural-width">true</property>
+ <property name="visible">true</property>
+ <property name="vexpand">true</property>
+ <child>
+ <object class="GtkListBox" id="names_list_box">
+ <property name="selection-mode">browse</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="orientation">horizontal</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSearchEntry" id="search_entry">
+ <property name="placeholder-text" translatable="yes">Search Bus Names</property>
+ <property name="has-frame">false</property>
<property name="visible">true</property>
</object>
</child>
diff --git a/src/plugins/dspy/gbp-dspy-workspace.c b/src/plugins/dspy/gbp-dspy-workspace.c
index ad7a556c9..9f32a6aa1 100644
--- a/src/plugins/dspy/gbp-dspy-workspace.c
+++ b/src/plugins/dspy/gbp-dspy-workspace.c
@@ -22,12 +22,16 @@
#include "config.h"
+#include "gbp-dspy-surface.h"
+#include "gbp-dspy-private.h"
#include "gbp-dspy-workspace.h"
struct _GbpDspyWorkspace
{
- IdeWorkspace parent_instance;
- IdeHeaderBar *header_bar;
+ IdeWorkspace parent_instance;
+ IdeHeaderBar *header_bar;
+ GtkSizeGroup *left_size_group;
+ GbpDspySurface *surface;
};
G_DEFINE_TYPE (GbpDspyWorkspace, gbp_dspy_workspace, IDE_TYPE_WORKSPACE)
@@ -42,12 +46,16 @@ gbp_dspy_workspace_class_init (GbpDspyWorkspaceClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/plugins/dspy/gbp-dspy-workspace.ui");
gtk_widget_class_bind_template_child (widget_class, GbpDspyWorkspace, header_bar);
+ gtk_widget_class_bind_template_child (widget_class, GbpDspyWorkspace, left_size_group);
+ gtk_widget_class_bind_template_child (widget_class, GbpDspyWorkspace, surface);
}
static void
gbp_dspy_workspace_init (GbpDspyWorkspace *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
+
+ _gbp_dspy_surface_set_size_group (self->surface, self->left_size_group);
}
GbpDspyWorkspace *
diff --git a/src/plugins/dspy/gbp-dspy-workspace.ui b/src/plugins/dspy/gbp-dspy-workspace.ui
index 95fa09274..5119d4182 100644
--- a/src/plugins/dspy/gbp-dspy-workspace.ui
+++ b/src/plugins/dspy/gbp-dspy-workspace.ui
@@ -9,13 +9,55 @@
<property name="show-fullscreen-button">false</property>
<property name="menu-id">dspy-workspace-menu</property>
<property name="visible">true</property>
+ <child type="left">
+ <object class="GtkBox" id="header_left_box">
+ <property name="halign">start</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkMenuButton">
+ <property name="hexpand">true</property>
+ <property name="halign">center</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="spacing">6</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="label">System</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">pan-down-symbolic</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
<child internal-child="surfaces">
<object class="GtkStack" id="surfaces">
<property name="visible">true</property>
<child>
- <object class="GbpDspySurface">
+ <object class="GbpDspySurface" id="surface">
<property name="visible">true</property>
</object>
<packing>
@@ -25,4 +67,10 @@
</object>
</child>
</template>
+ <object class="GtkSizeGroup" id="left_size_group">
+ <property name="mode">horizontal</property>
+ <widgets>
+ <widget name="header_left_box"/>
+ </widgets>
+ </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]