Commit 434b88ff authored by Stepan Salenikovich's avatar Stepan Salenikovich

gnome: main window layout

Refs #66715

Change-Id: I7bc09ae7c46aca1a80a18adb3b811c968c52eaaf
parent a8df7ead
......@@ -108,12 +108,15 @@ SET( SRC_FILES
src/ring_client.cpp
src/ring_client_options.h
src/ring_client_options.c
src/ringmainwindow.h
src/ringmainwindow.cpp
)
# compile glib resource files to c code
GLIB_COMPILE_RESOURCES( GLIB_RESOURCES_RING
SOURCE
pixmaps/pixmaps.gresource.xml
ui/ui.gresource.xml
)
# IF(${ENABLE_TEST} MATCHES true)
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
version="1.0"
sodipodi:docname="addressbook.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<title
id="title3009">addressbook.svg</title>
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient2433">
<stop
style="stop-color:#008000;stop-opacity:1;"
offset="0"
id="stop2435" />
<stop
style="stop-color:#008000;stop-opacity:0;"
offset="1"
id="stop2437" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 12 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="24 : 12 : 1"
inkscape:persp3d-origin="12 : 8 : 1"
id="perspective32" />
<linearGradient
id="linearGradient4269">
<stop
style="stop-color:#26b000;stop-opacity:1;"
offset="0"
id="stop4271" />
<stop
style="stop-color:#26b000;stop-opacity:0;"
offset="1"
id="stop4273" />
</linearGradient>
<linearGradient
id="linearGradient4183">
<stop
id="stop4185"
offset="0"
style="stop-color:#26b000;stop-opacity:1;" />
<stop
id="stop4187"
offset="1"
style="stop-color:#145f00;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient4167">
<stop
style="stop-color:#80000e;stop-opacity:1;"
offset="0"
id="stop4169" />
<stop
style="stop-color:#b00014;stop-opacity:0;"
offset="1"
id="stop4171" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2433"
id="linearGradient2439"
x1="2.965755"
y1="-0.80084854"
x2="32.578228"
y2="16.739393"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="-10.260191"
inkscape:cy="15.638715"
inkscape:document-units="px"
inkscape:current-layer="layer1"
width="32px"
height="32px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1313"
inkscape:window-height="744"
inkscape:window-x="337"
inkscape:window-y="1224"
showgrid="false"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>addressbook.svg</dc:title>
<dc:date>2014/06/24</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Gabrielle Maheux-Leclerc &lt;gabrielle.maheux@savoirfairelinux.com&gt;</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Savoir-faire Linux Inc.</dc:title>
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title>Savoir-faire Linux Inc.</dc:title>
</cc:Agent>
</dc:publisher>
<dc:source>http://sflphone.org/download/source-code</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>gnome</rdf:li>
<rdf:li>voip</rdf:li>
<rdf:li>sip</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:coverage>SFLphone project</dc:coverage>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0-2"
width="27.25"
height="27.25"
x="-25.687498"
y="-27.12499"
inkscape:label="a"
transform="scale(-1,-1)" />
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0"
width="27.357903"
height="27.357903"
x="-1.6802465"
y="-4.3527112"
inkscape:label="a" />
<rect
inkscape:label="a"
y="-18.073694"
x="-1.6802227"
height="27.402094"
width="27.402094"
id="rect44122-0"
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<rect
inkscape:label="a"
y="-24.857332"
x="-2.7434559"
height="26.103628"
width="26.103628"
id="rect43299-7-0"
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
transform="matrix(-0.25881905,0.96592583,-0.96592583,-0.25881905,0,0)" />
<rect
y="2.2499964"
x="-1.8749943"
height="27.875"
width="27.875"
id="rect3246-4-3-8-3-7"
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
style="fill:#545454;fill-opacity:1;stroke:none"
d="m 6.7792966,0.18749996 c -2.0666797,0 -3.7304688,1.66378904 -3.7304688,3.73046874 l 0,16.4140623 c 0,2.06668 1.6637891,3.730469 3.7304688,3.730469 l 11.9375004,0 c 2.066679,0 3.730468,-1.663789 3.730468,-3.730469 l 0,-16.4140623 c 0,-2.0666797 -1.663789,-3.73046874 -3.730468,-3.73046874 l -11.9375004,0 z M 12.93457,5.3635254 c 1.732206,0 3.077637,1.5201305 3.077637,3.310791 0,1.7906606 -1.345431,3.1708986 -3.077637,3.1708986 -1.732206,0 -3.1708984,-1.380238 -3.1708984,-3.1708986 0,-1.7906605 1.4386924,-3.310791 3.1708984,-3.310791 z m -2.657959,6.5749516 c 0.737514,0.673885 1.596268,0.979248 2.657959,0.979248 1.061691,0 1.920445,-0.305363 2.657959,-0.979248 1.404044,0.378752 2.611328,1.71882 2.611328,3.217529 l 0,3.217529 c 0,0.598742 -0.539918,1.025879 -1.119141,1.025879 l -8.3469233,0 c -0.5791777,0 -1.0732559,-0.427137 -1.0725098,-1.025879 l 0,-3.217529 c 0.00149,-1.744982 1.4515254,-2.824912 2.6113281,-3.217529 z"
id="rect8463-2-7-7"
inkscape:connector-curvature="0" />
<g
inkscape:label="accessories-calculator"
id="g40867-7-0-5"
transform="matrix(0,-1.4921875,1.4921875,0,-593.45313,95.6875)">
<rect
style="opacity:0.51464431;color:#bebebe;fill:none;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="rect40869-8-3-9"
width="16"
height="16"
x="48"
y="398" />
</g>
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect20566-4-6-4-5-4-1-8-4"
width="9.0690622"
height="9.0690622"
x="4.1474762"
y="7.854094"
inkscape:label="a" />
<path
sodipodi:nodetypes="cc"
id="path3601-2-3-3-9-6-5-6-9-6-9"
d="m 1.2498418,17.647545 4.3466118,0"
style="fill:none;stroke:#545454;stroke-width:1.62472236;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cc"
id="path3601-2-3-3-9-3-5-6-2-1-1-9"
d="m 1.2498418,14.00371 4.3466118,0"
style="fill:none;stroke:#545454;stroke-width:1.62472236;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cc"
id="path3601-2-3-3-9-3-3-8-3-5-1-0-0"
d="m 1.2498418,10.359875 4.3466118,0"
style="fill:none;stroke:#545454;stroke-width:1.62472236;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cc"
id="path3601-2-3-3-9-3-3-7-0-6-5-6-3-1"
d="m 1.2498418,6.7160399 4.3466118,0"
style="fill:none;stroke:#545454;stroke-width:1.62472236;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0" />
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
version="1.0"
sodipodi:docname="current.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient2433">
<stop
style="stop-color:#008000;stop-opacity:1;"
offset="0"
id="stop2435" />
<stop
style="stop-color:#008000;stop-opacity:0;"
offset="1"
id="stop2437" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 12 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="24 : 12 : 1"
inkscape:persp3d-origin="12 : 8 : 1"
id="perspective32" />
<linearGradient
id="linearGradient4269">
<stop
style="stop-color:#26b000;stop-opacity:1;"
offset="0"
id="stop4271" />
<stop
style="stop-color:#26b000;stop-opacity:0;"
offset="1"
id="stop4273" />
</linearGradient>
<linearGradient
id="linearGradient4183">
<stop
id="stop4185"
offset="0"
style="stop-color:#26b000;stop-opacity:1;" />
<stop
id="stop4187"
offset="1"
style="stop-color:#145f00;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient4167">
<stop
style="stop-color:#80000e;stop-opacity:1;"
offset="0"
id="stop4169" />
<stop
style="stop-color:#b00014;stop-opacity:0;"
offset="1"
id="stop4171" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2433"
id="linearGradient2439"
x1="2.965755"
y1="-0.80084854"
x2="32.578228"
y2="16.739393"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="10.302309"
inkscape:cy="16.452644"
inkscape:document-units="px"
inkscape:current-layer="layer1"
width="32px"
height="32px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1301"
inkscape:window-height="744"
inkscape:window-x="65"
inkscape:window-y="456"
showgrid="false"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0-2"
width="27.25"
height="27.25"
x="-25.687498"
y="-27.12499"
inkscape:label="a"
transform="scale(-1,-1)" />
<rect
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
id="rect44095-0"
width="27.357903"
height="27.357903"
x="-1.6802465"
y="-4.3527112"
inkscape:label="a" />
<rect
inkscape:label="a"
y="-18.073694"
x="-1.6802227"
height="27.402094"
width="27.402094"
id="rect44122-0"
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<rect
inkscape:label="a"
y="-24.857332"
x="-2.7434559"
height="26.103628"
width="26.103628"
id="rect43299-7-0"
style="color:#bebebe;fill:none;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
transform="matrix(-0.25881905,0.96592583,-0.96592583,-0.25881905,0,0)" />
<g
transform="matrix(2.1681981,0,0,2.1681981,-280.4028,-1203.9792)"
id="g4148"
style="fill:#545454;fill-opacity:1">
<rect
y="555.31415"
x="130.90933"
height="2.0369332"
width="2.0369332"
id="rect4039"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-557.35272"
x="133.89476"
height="2.0369332"
width="2.0369332"
id="rect4039-1"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-557.35107"
x="136.87463"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-560.33374"
x="136.87463"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6-8"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-560.2973"
x="133.92836"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6-8-1"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-560.37006"
x="130.87296"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6-8-2"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-563.35278"
x="130.87296"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6-8-16"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-563.35272"
x="133.89197"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6-8-6"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-563.31641"
x="136.87463"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6-8-67"
style="fill:#545454;fill-opacity:1;stroke:none" />
<rect
transform="scale(1,-1)"
y="-566.33539"
x="133.92834"
height="2.0369332"
width="2.0369332"
id="rect4039-1-6-8-3"
style="fill:#545454;fill-opacity:1;stroke:none" />
</g>
</g>
</svg>
This diff is collapsed.
......@@ -3,5 +3,9 @@
<gresource prefix="/cx/ring/RingGnome">
<file alias="ring-symbol-blue">symbole-ring-coul.svg</file>
<file alias="ring-logo-blue">logo-ring-standard-coul.svg</file>
<file alias="addressbook_small">addressbook.svg</file>
<file alias="history_small">history.svg</file>
<file alias="users_small">users.svg</file>
<file alias="dial">dial.svg</file>
</gresource>
</gresources>
\ No newline at end of file
This diff is collapsed.
......@@ -38,6 +38,19 @@
#include <callmodel.h>
#include "ring_client_options.h"
#include "ringmainwindow.h"
struct _RingClientClass
{
GtkApplicationClass parent_class;
};
struct _RingClient
{
GtkApplication parent;
};
typedef struct _RingClientPrivate RingClientPrivate;
struct _RingClientPrivate {
/* main window */
......@@ -46,7 +59,7 @@ struct _RingClientPrivate {
QCoreApplication *qtapp;
};
G_DEFINE_TYPE(RingClient, ring_client, GTK_TYPE_APPLICATION);
G_DEFINE_TYPE_WITH_PRIVATE(RingClient, ring_client, GTK_TYPE_APPLICATION);
#define RING_CLIENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), RING_CLIENT_TYPE, RingClientPrivate))
......@@ -88,6 +101,9 @@ ring_client_command_line(GApplication *app, GApplicationCommandLine *cmdline)
GtkSettings *gtk_settings = gtk_settings_get_default();
g_object_set(G_OBJECT(gtk_settings), "gtk-application-prefer-dark-theme",
FALSE, NULL);
/* enable button icons */
g_object_set(G_OBJECT(gtk_settings), "gtk-button-images",
TRUE, NULL);
/* init libRingClient and make sure its connected to the dbus */
try {
......@@ -106,15 +122,9 @@ ring_client_command_line(GApplication *app, GApplicationCommandLine *cmdline)
}
/* create an empty window */
priv->win = gtk_application_window_new(GTK_APPLICATION(app));
/* test gresources */
GdkPixbuf* icon = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-symbol-blue", &error);
if (icon == NULL) {
g_debug("Could not load icon: %s", error->message);
g_error_free(error);
} else
gtk_window_set_icon(GTK_WINDOW(priv->win), icon);
if (priv->win == NULL) {
priv->win = ring_main_window_new(GTK_APPLICATION(app));
}
gtk_window_present(GTK_WINDOW(priv->win));
......@@ -148,10 +158,6 @@ ring_client_init(RingClient *self)
static void
ring_client_class_init(RingClientClass *klass)
{
g_debug("ring_client_class_init()");
g_type_class_add_private(klass, sizeof(RingClientPrivate));
G_APPLICATION_CLASS(klass)->command_line = ring_client_command_line;
G_APPLICATION_CLASS(klass)->shutdown = ring_client_shutdown;
}
......@@ -160,6 +166,6 @@ RingClient *
ring_client_new()
{
return (RingClient *)g_object_new(ring_client_get_type(),
"application-id", "cx.ring.RingGnome",
"flags", G_APPLICATION_HANDLES_COMMAND_LINE, NULL);
"application-id", "cx.ring.RingGnome",
"flags", G_APPLICATION_HANDLES_COMMAND_LINE, NULL);
}
......@@ -33,28 +33,19 @@
#include <gtk/gtk.h>
G_BEGIN_DECLS
// #define RING_GSETTINGS_SCHEMA "cx.ring.RingGnome"
#define RING_CLIENT_TYPE (ring_client_get_type())
#define RING_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RING_CLIENT_TYPE, RingClient))
typedef struct _RingClientPrivate RingClientPrivate;
typedef struct _RingClientClass RingClientClass;
typedef struct _RingClient RingClient;
struct _RingClientClass
{
GtkApplicationClass parent_class;
};
struct _RingClient
{
GtkApplication parent;
/* Private */
RingClientPrivate *priv;
};
typedef struct _RingClientClass RingClientClass;
typedef struct _RingClient RingClient;
/* Public interface */
GType ring_client_get_type(void) G_GNUC_CONST;
RingClient *ring_client_new(void);
GType ring_client_get_type (void) G_GNUC_CONST;
RingClient *ring_client_new (void);
G_END_DECLS
#endif /* RING_CLIENT_H_ */
......@@ -33,14 +33,10 @@
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
GOptionContext *ring_client_options_get_context(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* RING_CLIENT_OPTIONS_H_ */
/*
* Copyright (C) 2015 Savoir-Faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "ringmainwindow.h"
#include <gtk/gtk.h>
struct _RingMainWindow
{
GtkApplicationWindow parent;
};
struct _RingMainWindowClass
{
GtkApplicationWindowClass parent_class;
};
typedef struct _RingMainWindowPrivate RingMainWindowPrivate;
struct _RingMainWindowPrivate
{
GtkWidget *gears;
GtkWidget *gears_image;
};
G_DEFINE_TYPE_WITH_PRIVATE(RingMainWindow, ring_main_window, GTK_TYPE_APPLICATION_WINDOW);
#define RING_MAIN_WINDOW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), RING_MAIN_WINDOW_TYPE, RingMainWindowPrivate))
static void
ring_main_window_init(RingMainWindow *win)
{
RingMainWindowPrivate *priv = RING_MAIN_WINDOW_GET_PRIVATE(win);
gtk_widget_init_template(GTK_WIDGET(win));
/* set window icon */
GError *error = NULL;
GdkPixbuf* icon = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/ring-symbol-blue", &error);
if (icon == NULL) {
g_debug("Could not load icon: %s", error->message);
g_error_free(error);
} else
gtk_window_set_icon(GTK_WINDOW(win), icon);
/* set menu icon */
GdkPixbuf* ring_gears = gdk_pixbuf_new_from_resource_at_scale("/cx/ring/RingGnome/ring-logo-blue",
-1, 22, TRUE, &error);
if (ring_gears == NULL) {
g_debug("Could not load icon: %s", error->message);
g_error_free(error);
} else
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->gears_image), ring_gears);
/* gears menu */
GtkBuilder *builder = gtk_builder_new_from_resource("/cx/ring/RingGnome/ringgearsmenu.ui");
GMenuModel *menu = G_MENU_MODEL(gtk_builder_get_object(builder, "menu"));
gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(priv->gears), menu);
g_object_unref(builder);
}
static void
ring_main_window_class_init(RingMainWindowClass *klass)
{
gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS (klass),
"/cx/ring/RingGnome/ringmainwindow.ui");
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), RingMainWindow, gears);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), RingMainWindow, gears_image);
}