window: use GtkPopovers
GNOME Calendar uses a custom GtkOverlay-based widget, witch is not necessary anymore. It should be replaced by GtkPopover.
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
a9e8eb311a
commit
1e1052c65c
@@ -4,7 +4,6 @@
|
||||
<file alias="nav_bar.ui" compressed="true" preprocess="xml-stripblanks">ui/nav_bar.ui</file>
|
||||
<file alias="viewport.ui" compressed="true" preprocess="xml-stripblanks">ui/viewport.ui</file>
|
||||
<file alias="new-event.ui" compressed="true" preprocess="xml-stripblanks">ui/new-event.ui</file>
|
||||
<file alias="close.svg" compressed="true" preprocess="xml-stripblanks">theme/close-window.svg</file>
|
||||
<file alias="gtk-styles.css" compressed="true">theme/gtk-styles.css</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
|
||||
|
||||
<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"
|
||||
version="1.0"
|
||||
id="Foreground"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 23.272727 23.272727"
|
||||
enable-background="new 0 0 16 16"
|
||||
xml:space="preserve"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.48+devel r10081 custom"
|
||||
sodipodi:docname="close-window.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
|
||||
id="metadata2399"><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 /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs2397"><linearGradient
|
||||
id="linearGradient3173"><stop
|
||||
style="stop-color:#c4c4c4;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3175" /><stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3177" /></linearGradient><inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 8 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="16 : 8 : 1"
|
||||
inkscape:persp3d-origin="8 : 5.3333333 : 1"
|
||||
id="perspective2401" /><filter
|
||||
color-interpolation-filters="sRGB"
|
||||
inkscape:collect="always"
|
||||
id="filter16494-4"
|
||||
x="-0.20989846"
|
||||
width="1.4197969"
|
||||
y="-0.20903821"
|
||||
height="1.4180764"><feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="1.3282637"
|
||||
id="feGaussianBlur16496-8" /></filter><radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient16498-6"
|
||||
id="radialGradient16504-1"
|
||||
cx="7.6582627"
|
||||
cy="5.8191104"
|
||||
fx="7.6582627"
|
||||
fy="5.8191104"
|
||||
r="8.6928644"
|
||||
gradientTransform="matrix(1.0474339,0,0,1.0517402,-0.3632615,-0.42032492)"
|
||||
gradientUnits="userSpaceOnUse" /><linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient16498-6"><stop
|
||||
style="stop-color:#7b7b7b;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop16500-8" /><stop
|
||||
style="stop-color:#101010;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop16502-0" /></linearGradient><filter
|
||||
color-interpolation-filters="sRGB"
|
||||
inkscape:collect="always"
|
||||
id="filter16524-9"
|
||||
x="-0.212979"
|
||||
width="1.425958"
|
||||
y="-0.21305652"
|
||||
height="1.426113"><feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="0.71020915"
|
||||
id="feGaussianBlur16526-0" /></filter></defs><sodipodi:namedview
|
||||
inkscape:window-height="1114"
|
||||
inkscape:window-width="1463"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0"
|
||||
guidetolerance="10.0"
|
||||
gridtolerance="10.0"
|
||||
objecttolerance="10.0"
|
||||
borderopacity="1.0"
|
||||
bordercolor="#666666"
|
||||
pagecolor="#000000"
|
||||
id="base"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1"
|
||||
inkscape:cx="10.720189"
|
||||
inkscape:cy="13.739577"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="26"
|
||||
inkscape:current-layer="Foreground"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
borderlayer="true"
|
||||
inkscape:showpageshadow="false"
|
||||
inkscape:window-maximized="0"><inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid11246"
|
||||
empspacing="5"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true" /></sodipodi:namedview>
|
||||
|
||||
<g
|
||||
style="display:inline"
|
||||
id="g16402-8"
|
||||
transform="translate(4.7533483,2.8238929)"><g
|
||||
id="g3175-4"><path
|
||||
sodipodi:type="inkscape:offset"
|
||||
inkscape:radius="0"
|
||||
inkscape:original="M 7.65625 0.125 C 3.2589349 0.125 -0.3125 3.7070002 -0.3125 8.125 C -0.3125 12.543001 3.2589349 16.125 7.65625 16.125 C 12.053566 16.125 15.625 12.543001 15.625 8.125 C 15.625 3.7070002 12.053566 0.125 7.65625 0.125 z "
|
||||
xlink:href="#path2394-32"
|
||||
style="opacity:0.52994014;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2.18181825;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter16494-4);enable-background:accumulate"
|
||||
id="path16480-5"
|
||||
inkscape:href="#path2394-32"
|
||||
d="m 7.65625,0.125 c -4.3973151,0 -7.96875,3.5820002 -7.96875,8 0,4.418001 3.5714349,8 7.96875,8 4.397316,0 7.96875,-3.581999 7.96875,-8 0,-4.4179998 -3.571434,-8 -7.96875,-8 z"
|
||||
transform="translate(0,1.028519)" /><path
|
||||
clip-rule="evenodd"
|
||||
d="m -0.30428257,8.1237596 c 0,-4.4179998 3.56522987,-7.9999996 7.96254497,-7.9999996 4.3973156,0 7.9625456,3.5819998 7.9625456,7.9999996 0,4.4180014 -3.56523,8.0000004 -7.9625456,8.0000004 -4.3973151,0 -7.96254497,-3.581999 -7.96254497,-8.0000004 z"
|
||||
id="path2394-32"
|
||||
style="color:#000000;fill:url(#radialGradient16504-1);fill-opacity:1;fill-rule:nonzero;stroke:#eeeeec;stroke-width:1.4545455;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
sodipodi:nodetypes="csssc"
|
||||
inkscape:connector-curvature="0" /><g
|
||||
id="g3172-6" /></g><g
|
||||
transform="matrix(0.72727273,0,0,0.72727273,2.368236,2.1803254)"
|
||||
style="fill:#ffffff;fill-opacity:1;display:inline"
|
||||
id="g27275-6-6"
|
||||
inkscape:label="window-close"><g
|
||||
style="fill:#ffffff;fill-opacity:1;display:inline"
|
||||
id="g27277-1-1"
|
||||
transform="translate(-41,-760)"><path
|
||||
sodipodi:type="inkscape:offset"
|
||||
inkscape:radius="0"
|
||||
inkscape:original="M 44.21875 764.1875 L 44.21875 765.1875 C 44.19684 765.46825 44.289258 765.74287 44.5 765.9375 L 46.78125 768.21875 L 44.5 770.46875 C 44.31181 770.65692 44.218747 770.92221 44.21875 771.1875 L 44.21875 772.1875 L 45.21875 772.1875 C 45.48404 772.1875 45.749336 772.09444 45.9375 771.90625 L 48.21875 769.625 L 50.5 771.90625 C 50.688164 772.0944 50.953449 772.18749 51.21875 772.1875 L 52.21875 772.1875 L 52.21875 771.1875 C 52.218742 770.9222 52.125688 770.65692 51.9375 770.46875 L 49.6875 768.21875 L 51.96875 765.9375 C 52.18441 765.73815 52.21875 765.47397 52.21875 765.1875 L 52.21875 764.1875 L 51.21875 764.1875 C 50.977922 764.1945 50.796875 764.2695 50.53125 764.5 L 48.21875 766.78125 L 45.9375 764.5 C 45.75987 764.31608 45.504951 764.1987 45.25 764.1875 C 45.23954 764.18704 45.22912 764.18738 45.21875 764.1875 L 44.21875 764.1875 z "
|
||||
xlink:href="#path27279-0-5"
|
||||
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#bebebe;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.78124988;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter16524-9);enable-background:new;font-family:Andale Mono;-inkscape-font-specification:Andale Mono"
|
||||
id="path16506-5"
|
||||
inkscape:href="#path27279-0-5"
|
||||
d="m 44.21875,764.1875 0,1 c -0.02191,0.28075 0.07051,0.55537 0.28125,0.75 l 2.28125,2.28125 -2.28125,2.25 c -0.18819,0.18817 -0.281253,0.45346 -0.28125,0.71875 l 0,1 1,0 c 0.26529,0 0.530586,-0.0931 0.71875,-0.28125 L 48.21875,769.625 50.5,771.90625 c 0.188164,0.18815 0.453449,0.28124 0.71875,0.28125 l 1,0 0,-1 c -8e-6,-0.2653 -0.09306,-0.53058 -0.28125,-0.71875 l -2.25,-2.25 2.28125,-2.28125 c 0.21566,-0.19935 0.25,-0.46353 0.25,-0.75 l 0,-1 -1,0 c -0.240828,0.007 -0.421875,0.082 -0.6875,0.3125 l -2.3125,2.28125 L 45.9375,764.5 c -0.17763,-0.18392 -0.432549,-0.3013 -0.6875,-0.3125 -0.01046,-4.6e-4 -0.02088,-1.2e-4 -0.03125,0 l -1,0 z"
|
||||
transform="translate(0,1.3535534)" /><path
|
||||
sodipodi:nodetypes="ccsccccccccccccccccccccccc"
|
||||
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#bebebe;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.78124988;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Andale Mono;-inkscape-font-specification:Andale Mono"
|
||||
id="path27279-0-5"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 44.226475,764.17222 1,0 c 0.01037,-1.2e-4 0.02079,-4.6e-4 0.03125,0 0.254951,0.0112 0.50987,0.12858 0.6875,0.3125 l 2.28125,2.28125 2.3125,-2.28125 c 0.265625,-0.2305 0.446672,-0.3055 0.6875,-0.3125 l 1,0 0,1 c 0,0.28647 -0.03434,0.55065 -0.25,0.75 l -2.28125,2.28125 2.25,2.25 c 0.188188,0.18817 0.281242,0.45345 0.28125,0.71875 l 0,1 -1,0 c -0.265301,-1e-5 -0.530586,-0.0931 -0.71875,-0.28125 l -2.28125,-2.28125 -2.28125,2.28125 c -0.188164,0.18819 -0.45346,0.28125 -0.71875,0.28125 l -1,0 0,-1 c -3e-6,-0.26529 0.09306,-0.53058 0.28125,-0.71875 l 2.28125,-2.25 -2.28125,-2.28125 c -0.210742,-0.19463 -0.30316,-0.46925 -0.28125,-0.75 l 0,-1 z" /></g></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 9.4 KiB |
+73
-91
@@ -1,139 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.10 -->
|
||||
<template class="GcalNewEventWidget" parent="GtkOverlay">
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<template class="GcalNewEventWidget" parent="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<style>
|
||||
<class name="new-event-widget"/>
|
||||
</style>
|
||||
<child type="overlay">
|
||||
<object class="GtkButton" id="close_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="relief">none</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="resource">/org/gnome/calendar/close.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GcalArrowBin" id="container">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">14</property>
|
||||
<style>
|
||||
<class name="arrow-bin"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkGrid" id="main_grid">
|
||||
<object class="GtkGrid" id="container">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">14</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="main_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">18</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">18</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<property name="margin">18</property>
|
||||
<child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="title_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="create_button">
|
||||
<property name="label" translatable="yes">Create</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
<property name="label" translatable="yes">Create</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="details_button">
|
||||
<property name="label" translatable="yes">More Details</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="label" translatable="yes">More Details</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="row_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="what_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="what_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="calendar_button">
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="calendar_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">x-office-calendar-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">x-office-calendar-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/*
|
||||
* gcal-new-event-widget.c
|
||||
* Copyright (C) 2012 Erick Pérez Castellanos <erickpc@gnome.org>
|
||||
* Copyright (C) 2014 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
||||
*
|
||||
* gnome-calendar is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -18,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include "gcal-new-event-widget.h"
|
||||
#include "gcal-arrow-bin.h"
|
||||
#include "gcal-utils.h"
|
||||
|
||||
typedef struct
|
||||
@@ -26,17 +26,14 @@ typedef struct
|
||||
GtkWidget *title_label;
|
||||
GtkWidget *what_entry;
|
||||
GtkWidget *calendar_button;
|
||||
|
||||
GtkWidget *create_button;
|
||||
GtkWidget *details_button;
|
||||
|
||||
GtkWidget *close_button;
|
||||
} GcalNewEventWidgetPrivate;
|
||||
|
||||
static void item_activated (GtkWidget *item,
|
||||
gpointer user_data);
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GcalNewEventWidget, gcal_new_event_widget, GTK_TYPE_OVERLAY)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GcalNewEventWidget, gcal_new_event_widget, GTK_TYPE_GRID)
|
||||
|
||||
static void
|
||||
item_activated (GtkWidget *item,
|
||||
@@ -84,7 +81,7 @@ gcal_new_event_widget_class_init (GcalNewEventWidgetClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNewEventWidget, calendar_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNewEventWidget, create_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNewEventWidget, details_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GcalNewEventWidget, close_button);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -264,23 +261,6 @@ gcal_new_event_widget_get_details_button (GcalNewEventWidget *widget)
|
||||
return priv->details_button;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_new_event_widget_get_close_button:
|
||||
* @widget: a #GcalNewEventWidget
|
||||
*
|
||||
* Get a pointer a to the close button in the widget.
|
||||
*
|
||||
* Returns: (transfer none) a #GtkWidget
|
||||
**/
|
||||
GtkWidget*
|
||||
gcal_new_event_widget_get_close_button (GcalNewEventWidget *widget)
|
||||
{
|
||||
GcalNewEventWidgetPrivate *priv;
|
||||
|
||||
priv = gcal_new_event_widget_get_instance_private (widget);
|
||||
return priv->close_button;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_new_event_widget_get_calendar_uid:
|
||||
* @widget: a #GcalNewEventWidget
|
||||
|
||||
@@ -47,12 +47,12 @@ typedef struct _GcalNewEventWidgetClass GcalNewEventWidgetClass;
|
||||
|
||||
struct _GcalNewEventWidget
|
||||
{
|
||||
GtkOverlay parent;
|
||||
GtkGrid parent;
|
||||
};
|
||||
|
||||
struct _GcalNewEventWidgetClass
|
||||
{
|
||||
GtkOverlayClass parent_class;
|
||||
GtkGridClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+36
-71
@@ -2,6 +2,7 @@
|
||||
/*
|
||||
* gcal-window.c
|
||||
* Copyright (C) 2012 Erick Pérez Castellanos <erickpc@gnome.org>
|
||||
* Copyright (C) 2014 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
|
||||
*
|
||||
* gnome-calendar is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -64,8 +65,9 @@ typedef struct
|
||||
GtkWidget *nav_bar;
|
||||
GtkWidget *views_overlay;
|
||||
GtkWidget *views_stack;
|
||||
GtkWidget *new_event_widget;
|
||||
GtkWidget *noty; /* short-lived */
|
||||
GtkWidget *new_event_widget; /* short-lived */
|
||||
GtkWidget *popover; /* short-lived */
|
||||
|
||||
/* header_bar widets */
|
||||
GtkWidget *new_button;
|
||||
@@ -130,10 +132,9 @@ static void show_new_event_widget (GcalView *v
|
||||
gdouble y,
|
||||
gpointer user_data);
|
||||
|
||||
static gboolean place_new_event_widget (GtkOverlay *overlay,
|
||||
GtkWidget *child,
|
||||
GdkRectangle *allocation,
|
||||
gpointer user_data);
|
||||
static gboolean place_new_event_widget (GtkWidget *popover,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
static void close_new_event_widget (GtkButton *button,
|
||||
gpointer user_data);
|
||||
@@ -458,7 +459,6 @@ view_changed (GObject *object,
|
||||
gpointer user_data)
|
||||
{
|
||||
GcalWindowPrivate *priv;
|
||||
|
||||
GEnumClass *eklass;
|
||||
GEnumValue *eval;
|
||||
GcalWindowViewType view_type;
|
||||
@@ -489,7 +489,6 @@ static void
|
||||
set_new_event_mode (GcalWindow *window,
|
||||
gboolean enabled)
|
||||
{
|
||||
|
||||
GcalWindowPrivate *priv;
|
||||
|
||||
priv = gcal_window_get_instance_private (window);
|
||||
@@ -501,10 +500,10 @@ set_new_event_mode (GcalWindow *window,
|
||||
|
||||
/* XXX: here we could disable clicks from the views, yet */
|
||||
/* for now we relaunch the new-event widget */
|
||||
if (priv->new_event_widget != NULL)
|
||||
if (!enabled &&
|
||||
gtk_widget_is_visible (priv->popover))
|
||||
{
|
||||
gtk_widget_destroy (priv->new_event_widget);
|
||||
priv->new_event_widget = NULL;
|
||||
gtk_widget_set_visible (priv->popover, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,9 +523,6 @@ prepare_new_event_widget (GcalWindow *window)
|
||||
GtkWidget *widget;
|
||||
|
||||
priv = gcal_window_get_instance_private (window);
|
||||
|
||||
/* FIXME: ensure destruction or singleton pattern */
|
||||
priv->new_event_widget = gcal_new_event_widget_new ();
|
||||
new_widget = GCAL_NEW_EVENT_WIDGET (priv->new_event_widget);
|
||||
|
||||
/* setting title */
|
||||
@@ -546,9 +542,13 @@ prepare_new_event_widget (GcalWindow *window)
|
||||
gcal_new_event_widget_set_default_calendar (new_widget, uid);
|
||||
g_free (uid);
|
||||
|
||||
/* clear entry */
|
||||
widget = gcal_new_event_widget_get_entry (new_widget);
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), "");
|
||||
|
||||
/* FIXME: add signals handling */
|
||||
widget = gcal_new_event_widget_get_close_button (new_widget);
|
||||
g_signal_connect (widget, "clicked",
|
||||
widget = GTK_WIDGET (priv->popover);
|
||||
g_signal_connect (widget, "closed",
|
||||
G_CALLBACK (close_new_event_widget), window);
|
||||
widget = gcal_new_event_widget_get_create_button (new_widget);
|
||||
g_signal_connect_swapped (widget, "clicked",
|
||||
@@ -559,8 +559,7 @@ prepare_new_event_widget (GcalWindow *window)
|
||||
widget = gcal_new_event_widget_get_entry (new_widget);
|
||||
g_signal_connect_swapped (widget, "activate",
|
||||
G_CALLBACK (create_event), window);
|
||||
|
||||
gtk_widget_show_all (priv->new_event_widget);
|
||||
gtk_widget_show_all (priv->popover);
|
||||
}
|
||||
|
||||
/* new-event interaction: second variant */
|
||||
@@ -595,58 +594,26 @@ show_new_event_widget (GcalView *view,
|
||||
priv->event_creation_data->end_date = gcal_dup_icaltime (end_span);
|
||||
g_debug ("[show_new_event] position (%f, %f)", x, y);
|
||||
|
||||
/* Setup new event widget data */
|
||||
prepare_new_event_widget (GCAL_WINDOW (user_data));
|
||||
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (priv->views_overlay),
|
||||
priv->new_event_widget);
|
||||
place_new_event_widget (priv->popover, x, y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
place_new_event_widget (GtkOverlay *overlay,
|
||||
GtkWidget *child,
|
||||
GdkRectangle *allocation,
|
||||
gpointer user_data)
|
||||
place_new_event_widget (GtkWidget *popover,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GcalWindowPrivate *priv;
|
||||
GdkRectangle rect;
|
||||
|
||||
gint nat_width;
|
||||
gint nat_height;
|
||||
gint nav_bar_height;
|
||||
/* Place popover over the given (x,y) position */
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.width = 1;
|
||||
rect.height = 1;
|
||||
|
||||
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
|
||||
|
||||
if (! priv->new_event_mode)
|
||||
return FALSE;
|
||||
|
||||
gtk_widget_get_preferred_width (priv->new_event_widget,
|
||||
NULL,
|
||||
&nat_width);
|
||||
gtk_widget_get_preferred_height_for_width (priv->new_event_widget,
|
||||
nat_width,
|
||||
NULL,
|
||||
&nat_height);
|
||||
nav_bar_height = gtk_widget_get_allocated_height (priv->nav_bar);
|
||||
|
||||
g_debug ("[allocate-child] incoming value (%d, %d) - (%d, %d)",
|
||||
allocation->x,
|
||||
allocation->y,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
g_debug ("[allocate-child] natural size (%d, %d)",
|
||||
nat_width, nat_height);
|
||||
allocation->x = priv->event_creation_data->x - nat_width / 2;
|
||||
allocation->y = priv->event_creation_data->y + nav_bar_height - nat_height;
|
||||
allocation->width = nat_width;
|
||||
allocation->height = nat_height;
|
||||
|
||||
g_debug ("[allocate-child]: outgoing value (%d, %d) - (%d, %d)",
|
||||
allocation->x,
|
||||
allocation->y,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
|
||||
gtk_widget_grab_focus (gcal_new_event_widget_get_entry (
|
||||
GCAL_NEW_EVENT_WIDGET (priv->new_event_widget)));
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &rect);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -801,11 +768,6 @@ gcal_window_constructed (GObject *object)
|
||||
g_object_ref_sink (priv->views_switcher);
|
||||
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (priv->header_bar),
|
||||
priv->views_switcher);
|
||||
g_object_bind_property (object,
|
||||
"new-event-mode",
|
||||
priv->views_switcher,
|
||||
"sensitive",
|
||||
G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN);
|
||||
|
||||
/* header_bar: menu */
|
||||
menu_button = gd_header_menu_button_new ();
|
||||
@@ -917,6 +879,13 @@ gcal_window_constructed (GObject *object)
|
||||
gtk_widget_get_style_context (GTK_WIDGET (object)),
|
||||
"views");
|
||||
|
||||
/* popover and content */
|
||||
priv->popover = gtk_popover_new (GTK_WIDGET(priv->views_stack));
|
||||
|
||||
priv->new_event_widget = gcal_new_event_widget_new ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER(priv->popover), GTK_WIDGET(priv->new_event_widget));
|
||||
|
||||
/* signals connection/handling */
|
||||
g_signal_connect (object, "key-press-event",
|
||||
G_CALLBACK (key_pressed), object);
|
||||
@@ -928,8 +897,6 @@ gcal_window_constructed (GObject *object)
|
||||
g_signal_connect (priv->views[i], "create-event",
|
||||
G_CALLBACK (show_new_event_widget), object);
|
||||
}
|
||||
g_signal_connect (priv->views_overlay, "get-child-position",
|
||||
G_CALLBACK (place_new_event_widget), object);
|
||||
|
||||
g_signal_connect (priv->search_bar, "notify::search-mode-enabled",
|
||||
G_CALLBACK (gcal_window_search_toggled), object);
|
||||
@@ -1655,7 +1622,6 @@ void
|
||||
gcal_window_new_event (GcalWindow *window)
|
||||
{
|
||||
GcalWindowPrivate *priv;
|
||||
|
||||
gint x, y;
|
||||
|
||||
priv = gcal_window_get_instance_private (window);
|
||||
@@ -1704,8 +1670,7 @@ gcal_window_new_event (GcalWindow *window)
|
||||
|
||||
prepare_new_event_widget (GCAL_WINDOW (window));
|
||||
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (priv->views_overlay),
|
||||
priv->new_event_widget);
|
||||
place_new_event_widget (priv->popover, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user