Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adrien Plazas
libhandy
Commits
5ffe51be
Commit
5ffe51be
authored
Jan 07, 2020
by
Adrien Plazas
Browse files
Remove the deprecated HdyDialerButton
parent
3268755e
Changes
9
Hide whitespace changes
Inline
Side-by-side
debian/libhandy-1-0.symbols
View file @
5ffe51be
...
...
@@ -33,11 +33,6 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
hdy_combo_row_set_get_name_func@LIBHANDY_1_0 0.0.10
hdy_combo_row_set_selected_index@LIBHANDY_1_0 0.0.7
hdy_combo_row_set_use_subtitle@LIBHANDY_1_0 0.0.10
hdy_dialer_button_get_digit@LIBHANDY_1_0 0.0~git20180429
#MISSING: 0.0.3# hdy_dialer_button_get_letters@LIBHANDY_1_0 0.0.4~
hdy_dialer_button_get_symbols@LIBHANDY_1_0 0.0.3
hdy_dialer_button_get_type@LIBHANDY_1_0 0.0~git20180429
hdy_dialer_button_new@LIBHANDY_1_0 0.0~git20180429
hdy_dialog_get_narrow@LIBHANDY_1_0 0.0.11
hdy_dialog_get_type@LIBHANDY_1_0 0.0.7
hdy_dialog_new@LIBHANDY_1_0 0.0.7
...
...
doc/handy-docs.xml
View file @
5ffe51be
...
...
@@ -39,7 +39,6 @@
<xi:include
href=
"xml/hdy-animation.xml"
/>
<xi:include
href=
"xml/hdy-column.xml"
/>
<xi:include
href=
"xml/hdy-combo-row.xml"
/>
<xi:include
href=
"xml/hdy-dialer-button.xml"
/>
<xi:include
href=
"xml/hdy-dialog.xml"
/>
<xi:include
href=
"xml/hdy-enum-value-object.xml"
/>
<xi:include
href=
"xml/hdy-expander-row.xml"
/>
...
...
po/POTFILES.in
View file @
5ffe51be
src/gtkprogresstracker.c
src/hdy-column.c
src/hdy-dialer-button.c
src/hdy-fold.c
src/hdy-header-group.c
src/hdy-leaflet.c
...
...
src/handy.gresources.xml
View file @
5ffe51be
...
...
@@ -3,7 +3,6 @@
<gresource
prefix=
"/sm/puri/handy/ui"
>
<file
preprocess=
"xml-stripblanks"
>
hdy-action-row.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
hdy-combo-row.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
hdy-dialer-button.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
hdy-expander-row.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
hdy-keypad.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
hdy-keypad-button.ui
</file>
...
...
src/handy.h
View file @
5ffe51be
...
...
@@ -30,9 +30,6 @@ G_BEGIN_DECLS
#include
"hdy-column.h"
#include
"hdy-combo-row.h"
#include
"hdy-deprecation-macros.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#include
"hdy-dialer-button.h"
G_GNUC_END_IGNORE_DEPRECATIONS
#include
"hdy-dialog.h"
#include
"hdy-enum-value-object.h"
#include
"hdy-expander-row.h"
...
...
src/hdy-dialer-button.c
deleted
100644 → 0
View file @
3268755e
/*
* Copyright (C) 2017 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include
"config.h"
#include
<glib/gi18n-lib.h>
#include
"hdy-dialer-button.h"
/**
* SECTION:hdy-dialer-button
* @short_description: A button on a #HdyDialer keypad.
* @Title: HdyDialerButton
*
* The #HdyDialerButton widget is a single button on an #HdyDialer. It
* can represent a single symbol (typically a digit) plus an arbitrary
* number of symbols that are displayed below it.
*
* Deprecated: 0.0.12: This widget is considered a #HdyDialer internal api
*/
enum
{
PROP_0
,
PROP_DIGIT
,
PROP_SYMBOLS
,
PROP_LAST_PROP
,
};
static
GParamSpec
*
props
[
PROP_LAST_PROP
];
typedef
struct
{
GtkLabel
*
label
,
*
secondary_label
;
gchar
*
symbols
;
}
HdyDialerButtonPrivate
;
G_DEFINE_TYPE_WITH_PRIVATE
(
HdyDialerButton
,
hdy_dialer_button
,
GTK_TYPE_BUTTON
)
static
void
format_label
(
HdyDialerButton
*
self
)
{
HdyDialerButtonPrivate
*
priv
=
hdy_dialer_button_get_instance_private
(
self
);
gchar
*
symbols
=
priv
->
symbols
!=
NULL
?
priv
->
symbols
:
""
;
g_autofree
gchar
*
text
=
NULL
;
gchar
*
secondary_text
=
NULL
;
if
(
*
symbols
!=
'\0'
)
{
secondary_text
=
g_utf8_find_next_char
(
symbols
,
NULL
);
/* Allocate memory for the first character and '\0'. */
text
=
g_malloc0
(
secondary_text
-
symbols
+
1
);
g_utf8_strncpy
(
text
,
symbols
,
1
);
}
else
{
text
=
g_malloc0
(
sizeof
(
gchar
));
secondary_text
=
""
;
}
gtk_label_set_label
(
priv
->
label
,
text
);
gtk_label_set_label
(
priv
->
secondary_label
,
secondary_text
);
}
static
void
hdy_dialer_button_set_property
(
GObject
*
object
,
guint
property_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
{
HdyDialerButton
*
self
=
HDY_DIALER_BUTTON
(
object
);
HdyDialerButtonPrivate
*
priv
=
hdy_dialer_button_get_instance_private
(
self
);
switch
(
property_id
)
{
case
PROP_SYMBOLS
:
g_free
(
priv
->
symbols
);
priv
->
symbols
=
g_value_dup_string
(
value
);
format_label
(
self
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
property_id
,
pspec
);
break
;
}
}
static
void
hdy_dialer_button_get_property
(
GObject
*
object
,
guint
property_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
HdyDialerButton
*
self
=
HDY_DIALER_BUTTON
(
object
);
HdyDialerButtonPrivate
*
priv
=
hdy_dialer_button_get_instance_private
(
self
);
switch
(
property_id
)
{
case
PROP_DIGIT
:
g_value_set_int
(
value
,
hdy_dialer_button_get_digit
(
self
));
break
;
case
PROP_SYMBOLS
:
g_value_set_string
(
value
,
priv
->
symbols
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
property_id
,
pspec
);
break
;
}
}
/* This private method is prefixed by the call name because it will be a virtual
* method in GTK 4.
*/
static
void
hdy_dialer_button_measure
(
GtkWidget
*
widget
,
GtkOrientation
orientation
,
int
for_size
,
int
*
minimum
,
int
*
natural
,
int
*
minimum_baseline
,
int
*
natural_baseline
)
{
GtkWidgetClass
*
widget_class
=
GTK_WIDGET_CLASS
(
hdy_dialer_button_parent_class
);
gint
min1
,
min2
,
nat1
,
nat2
;
if
(
for_size
<
0
)
{
widget_class
->
get_preferred_width
(
widget
,
&
min1
,
&
nat1
);
widget_class
->
get_preferred_height
(
widget
,
&
min2
,
&
nat2
);
}
else
{
if
(
orientation
==
GTK_ORIENTATION_HORIZONTAL
)
widget_class
->
get_preferred_width_for_height
(
widget
,
for_size
,
&
min1
,
&
nat1
);
else
widget_class
->
get_preferred_height_for_width
(
widget
,
for_size
,
&
min1
,
&
nat1
);
min2
=
nat2
=
for_size
;
}
if
(
minimum
)
*
minimum
=
MAX
(
min1
,
min2
);
if
(
natural
)
*
natural
=
MAX
(
nat1
,
nat2
);
}
static
void
hdy_dialer_button_get_preferred_width
(
GtkWidget
*
widget
,
gint
*
minimum_width
,
gint
*
natural_width
)
{
hdy_dialer_button_measure
(
widget
,
GTK_ORIENTATION_HORIZONTAL
,
-
1
,
minimum_width
,
natural_width
,
NULL
,
NULL
);
}
static
void
hdy_dialer_button_get_preferred_height
(
GtkWidget
*
widget
,
gint
*
minimum_height
,
gint
*
natural_height
)
{
hdy_dialer_button_measure
(
widget
,
GTK_ORIENTATION_VERTICAL
,
-
1
,
minimum_height
,
natural_height
,
NULL
,
NULL
);
}
static
void
hdy_dialer_button_get_preferred_width_for_height
(
GtkWidget
*
widget
,
gint
height
,
gint
*
minimum_width
,
gint
*
natural_width
)
{
hdy_dialer_button_measure
(
widget
,
GTK_ORIENTATION_HORIZONTAL
,
height
,
minimum_width
,
natural_width
,
NULL
,
NULL
);
}
static
void
hdy_dialer_button_get_preferred_height_for_width
(
GtkWidget
*
widget
,
gint
width
,
gint
*
minimum_height
,
gint
*
natural_height
)
{
hdy_dialer_button_measure
(
widget
,
GTK_ORIENTATION_VERTICAL
,
width
,
minimum_height
,
natural_height
,
NULL
,
NULL
);
}
static
void
hdy_dialer_button_finalize
(
GObject
*
object
)
{
HdyDialerButton
*
self
=
HDY_DIALER_BUTTON
(
object
);
HdyDialerButtonPrivate
*
priv
=
hdy_dialer_button_get_instance_private
(
self
);
g_clear_pointer
(
&
priv
->
symbols
,
g_free
);
G_OBJECT_CLASS
(
hdy_dialer_button_parent_class
)
->
finalize
(
object
);
}
static
void
hdy_dialer_button_class_init
(
HdyDialerButtonClass
*
klass
)
{
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
klass
);
GtkWidgetClass
*
widget_class
=
GTK_WIDGET_CLASS
(
klass
);
object_class
->
set_property
=
hdy_dialer_button_set_property
;
object_class
->
get_property
=
hdy_dialer_button_get_property
;
object_class
->
finalize
=
hdy_dialer_button_finalize
;
widget_class
->
get_preferred_width
=
hdy_dialer_button_get_preferred_width
;
widget_class
->
get_preferred_height
=
hdy_dialer_button_get_preferred_height
;
widget_class
->
get_preferred_width_for_height
=
hdy_dialer_button_get_preferred_width_for_height
;
widget_class
->
get_preferred_height_for_width
=
hdy_dialer_button_get_preferred_height_for_width
;
props
[
PROP_DIGIT
]
=
g_param_spec_int
(
"digit"
,
_
(
"Digit"
),
_
(
"The dialer digit of the button"
),
-
1
,
INT_MAX
,
0
,
G_PARAM_READABLE
);
props
[
PROP_SYMBOLS
]
=
g_param_spec_string
(
"symbols"
,
_
(
"Symbols"
),
_
(
"The dialer symbols of the button"
),
""
,
G_PARAM_READWRITE
);
g_object_class_install_properties
(
object_class
,
PROP_LAST_PROP
,
props
);
gtk_widget_class_set_template_from_resource
(
widget_class
,
"/sm/puri/handy/ui/hdy-dialer-button.ui"
);
gtk_widget_class_bind_template_child_private
(
widget_class
,
HdyDialerButton
,
label
);
gtk_widget_class_bind_template_child_private
(
widget_class
,
HdyDialerButton
,
secondary_label
);
}
/**
* hdy_dialer_button_new:
* @symbols: (nullable): the symbols displayed on the #HdyDialerButton
*
* Create a new #HdyDialerButton which displays
* @symbols. If
* @symbols is %NULL no symbols will be displayed.
*
* Returns: the newly created #HdyDialerButton widget
*
* Deprecated: 0.0.12: This widget is considered a #HdyDialer internal
* api
*/
GtkWidget
*
hdy_dialer_button_new
(
const
gchar
*
symbols
)
{
return
g_object_new
(
HDY_TYPE_DIALER_BUTTON
,
"symbols"
,
symbols
,
NULL
);
}
static
void
hdy_dialer_button_init
(
HdyDialerButton
*
self
)
{
HdyDialerButtonPrivate
*
priv
=
hdy_dialer_button_get_instance_private
(
self
);
gtk_widget_init_template
(
GTK_WIDGET
(
self
));
priv
->
symbols
=
NULL
;
}
/**
* hdy_dialer_button_get_digit:
* @self: a #HdyDialerButton
*
* Get the #HdyDialerButton's digit.
*
* Returns: the button's digit
*
* Deprecated: 0.0.12: This widget is considered a #HdyDialer internal
* api
*/
gint
hdy_dialer_button_get_digit
(
HdyDialerButton
*
self
)
{
HdyDialerButtonPrivate
*
priv
;
gchar
*
symbols
;
g_return_val_if_fail
(
HDY_IS_DIALER_BUTTON
(
self
),
-
1
);
priv
=
hdy_dialer_button_get_instance_private
(
self
);
symbols
=
priv
->
symbols
;
g_return_val_if_fail
(
symbols
!=
NULL
,
-
1
);
g_return_val_if_fail
(
g_ascii_isdigit
(
*
symbols
),
-
1
);
return
*
symbols
-
'0'
;
}
/**
* hdy_dialer_button_get_symbols:
* @self: a #HdyDialerButton
*
* Get the #HdyDialerButton's symbols.
*
* Returns: the button's symbols.
*
* Deprecated: 0.0.12: This widget is considered a #HdyDialer internal
* api
*/
const
char
*
hdy_dialer_button_get_symbols
(
HdyDialerButton
*
self
)
{
HdyDialerButtonPrivate
*
priv
=
hdy_dialer_button_get_instance_private
(
self
);
g_return_val_if_fail
(
HDY_IS_DIALER_BUTTON
(
self
),
NULL
);
return
priv
->
symbols
;
}
src/hdy-dialer-button.h
deleted
100644 → 0
View file @
3268755e
/*
* Copyright (C) 2017 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
#include
"hdy-deprecation-macros.h"
#include
<gtk/gtk.h>
G_BEGIN_DECLS
#define HDY_TYPE_DIALER_BUTTON (hdy_dialer_button_get_type())
G_DECLARE_DERIVABLE_TYPE
(
HdyDialerButton
,
hdy_dialer_button
,
HDY
,
DIALER_BUTTON
,
GtkButton
)
_HDY_DEPRECATED
struct
_HdyDialerButtonClass
{
GtkButtonClass
parent_class
;
};
_HDY_DEPRECATED
GtkWidget
*
hdy_dialer_button_new
(
const
gchar
*
symbols
);
_HDY_DEPRECATED
gint
hdy_dialer_button_get_digit
(
HdyDialerButton
*
self
);
_HDY_DEPRECATED
const
char
*
hdy_dialer_button_get_symbols
(
HdyDialerButton
*
self
);
G_END_DECLS
src/hdy-dialer-button.ui
deleted
100644 → 0
View file @
3268755e
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.1 -->
<interface>
<requires
lib=
"gtk+"
version=
"3.20"
/>
<template
class=
"HdyDialerButton"
parent=
"GtkButton"
>
<property
name=
"can_focus"
>
True
</property>
<style>
<class
name=
"keypad"
/>
</style>
<child>
<object
class=
"GtkBox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"valign"
>
center
</property>
<child>
<object
class=
"GtkLabel"
id=
"label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
>
2
</property>
<attributes>
<attribute
name=
"weight"
value=
"bold"
/>
<attribute
name=
"scale"
value=
"2"
/>
</attributes>
</object>
</child>
<child>
<object
class=
"GtkLabel"
id=
"secondary_label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
>
ABC
</property>
<attributes>
<attribute
name=
"scale"
value=
"0.7"
/>
</attributes>
<style>
<class
name=
"dim-label"
/>
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
src/meson.build
View file @
5ffe51be
...
...
@@ -65,7 +65,6 @@ src_headers = [
'hdy-column.h',
'hdy-combo-row.h',
'hdy-deprecation-macros.h',
'hdy-dialer-button.h',
'hdy-dialog.h',
'hdy-enum-value-object.h',
'hdy-expander-row.h',
...
...
@@ -109,7 +108,6 @@ src_sources = [
'hdy-animation.c',
'hdy-column.c',
'hdy-combo-row.c',
'hdy-dialer-button.c',
'hdy-dialog.c',
'hdy-enum-value-object.c',
'hdy-expander-row.c',
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment